Conversation
requiring json throw error...
|
|
Currenlty, Transform of textlint don't work. import compileModule from '../../../utils/compileModule';
import pkg from 'textlint/package.json';
const ID = 'textlint';
export default {
id: ID,
displayName: ID,
version: pkg.version,
homepage: pkg.homepage,
defaultParserID: 'textlint:markdown-to-ast',
loadTransformer(callback) {
require(['textlint/lib/textlint-core', 'babel-core'], (TextLintCore, babel) => {
callback({ TextLintCore, babel });
})
},
transform({TextLintCore, babel}, transformCode, code) {
console.log(TextLintCore);
const textlintCore = new TextLintCore();
let rule = compileModule( // eslint-disable-line no-shadow
babel.transform(transformCode).code
);
textlintCore.setupRules({
'astExplorerRule': rule
});
return textlintCore.lintText(code, ".md").then(result => {
return JSON.stringify(result);
});
}
};Error |
|
Add promise support tot
|
Update with changes from fkling/astexplorer
feat: support textlint 13 and html plugin
fix(deps): update textlint to v14.8.0
fix(deps): update textlint to v14.8.1
fix(deps): update textlint to v15 (major)
fix(deps): update textlint to v15.0.1
fix(deps): update textlint to v15.2.1
* Add protobuf parser * feat: add protocol buffers parser * doc: add pbkit to README * remove an unused babel plugin * remove verdored parser * chore: up pbkit (#1) it resolves some parse error cases Co-authored-by: JongChan Choi <disjukr@naver.com>
- webpack.config.jsにnode:assertのaliasとnode設定を追加 - PR用のCIワークフロー(test.yml)を追加してビルドテストを実行 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
fix(build): webpackのnode:assertモジュール解決エラーを修正
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
chore(deps): update textlint to v15.3.0
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
chore(deps): update textlint to v15.5.1
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
| } | ||
|
|
||
| getPath() { | ||
| return `/snippet/${this.hash}}`; |
There was a problem hiding this comment.
🔴 Extra closing brace } in getPath() corrupts the URL hash
The getPath() method returns /snippet/${this.hash}} with a stray } after the template literal interpolation. This extra brace is appended to the URL hash via storage/index.js:20 (global.location.hash = revision.getPath()). When a user later navigates back to this URL, getIDAndRevisionFromHash() at urlStore.js:7 will capture the hash including the trailing }, and codec.decompress() will attempt to decode a corrupted string, likely throwing an error or producing garbage output.
| return `/snippet/${this.hash}}`; | |
| return `/snippet/${this.hash}`; |
Was this helpful? React with 👍 or 👎 to provide feedback.
| }, | ||
|
|
||
| transform({ TextlintKernel, plugin }, transformCode, code) { | ||
| const kernel = new Kernel(); |
There was a problem hiding this comment.
🔴 new Kernel() references undefined variable instead of TextlintKernel
In the transform method, the code uses new Kernel() but the parameter is destructured as { TextlintKernel, plugin }. Kernel is never defined, so this will throw a ReferenceError at runtime whenever the textlint-txt transformer is executed. The other transformers (markdown at textlint-md/transformers/textlint-markdown-to-ast/index.js:40 and HTML at textlint-html/transformers/textlint-plugin-html/index.js:41) correctly use new TextlintKernel().
| const kernel = new Kernel(); | |
| const kernel = new TextlintKernel(); |
Was this helpful? React with 👍 or 👎 to provide feedback.
| require(['@textlint/kernel'], ({ TextlintKernel }, { default: plugin }) => { | ||
| callback({ TextlintKernel, plugin }); | ||
| }) |
There was a problem hiding this comment.
🔴 loadTransformer for textlint-txt only requires one module but destructures two callback arguments
The require call passes only ['@textlint/kernel'] (one module), but the callback destructures two arguments: ({ TextlintKernel }, { default: plugin }). The second argument will be undefined, and destructuring undefined throws TypeError: Cannot destructure property 'default' of 'undefined'. Compare with the markdown transformer at textlint-md/transformers/textlint-markdown-to-ast/index.js:34 which correctly requires both modules: ['@textlint/kernel', '@textlint/textlint-plugin-markdown']. The txt transformer should similarly require @textlint/textlint-plugin-text.
| require(['@textlint/kernel'], ({ TextlintKernel }, { default: plugin }) => { | |
| callback({ TextlintKernel, plugin }); | |
| }) | |
| require(['@textlint/kernel', '@textlint/textlint-plugin-text'], ({ TextlintKernel }, { default: plugin }) => { | |
| callback({ TextlintKernel, plugin }); | |
| }) |
Was this helpful? React with 👍 or 👎 to provide feedback.
| export default { | ||
| ...defaultParserInterface, | ||
| id: ID, | ||
| displayName: "@textlint/text-to-ast", |
There was a problem hiding this comment.
🟡 Markdown parser displayName incorrectly shows @textlint/text-to-ast instead of @textlint/markdown-to-ast
The markdown parser at textlint-md/textlint-markdown-to-ast.js has displayName: "@textlint/text-to-ast" but the id is textlint:markdown-to-ast and it loads @textlint/markdown-to-ast. This appears to be a copy-paste error from the text parser. Users will see the wrong parser name in the UI.
| displayName: "@textlint/text-to-ast", | |
| displayName: "@textlint/markdown-to-ast", |
Was this helpful? React with 👍 or 👎 to provide feedback.
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
| getParserSettings() { | ||
| return this.data.settings[this.data.parserID]; | ||
| } |
There was a problem hiding this comment.
🔴 getParserSettings() crashes when this.data.settings is undefined
In website/src/storage/urlStore.js:103-104, getParserSettings() directly accesses this.data.settings[this.data.parserID] without checking if settings exists. If a decompressed snippet has no settings field, this throws a TypeError. The existing parse.js implementation (website/src/storage/parse.js:139-143) handles this correctly with a null check before accessing the property. The caller at website/src/store/reducers.js:214 uses revision.getParserSettings() || ..., which would handle null/undefined returns, but cannot catch the thrown exception.
| getParserSettings() { | |
| return this.data.settings[this.data.parserID]; | |
| } | |
| getParserSettings() { | |
| const settings = this.data.settings; | |
| if (!settings) { | |
| return null; | |
| } | |
| return settings[this.data.parserID]; | |
| } |
Was this helpful? React with 👍 or 👎 to provide feedback.
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>


Add Markdown and plain texts support.
Would We created a fork of astexplorer?
It is specific usage of textlint and textlint is a minor tool.
Pros
Re:Viewhttps://github.com/orangain/textlint-plugin-review ).Would the user of astexplorer need textlint support?
Cons
Ref: textlint/textlint#176