| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
ESLint plugin to lint script tags in HTML.
npm install @nice-move/eslint-plugin-html --save-dev// eslintrc.js
module.exports = {
extends: ['plugin:@nice-move/html/recommended']
};
// or
module.exports = {
extends: ['plugin:@nice-move/html/base']
};
// or
module.exports = {
overrides: [
{
files: ['*.{htm,html}'],
plugins: ['@nice-move/eslint-plugin-html']
},
{
files: ['**/*.{htm,html}/**/html-script-legacy.js'],
parserOptions: {
sourceType: 'script'
}
},
{
files: ['**/*.{htm,html}/**/html-script-module.js'],
parserOptions: {
sourceType: 'module'
}
}
]
};// eslint.config.mjs
import {
base,
recommended
} from '@nice-move/eslint-plugin-html/lib/configs-next.mjs';
let configs = [...base];
// or
configs = [...recommended];
// or
configs = [
{
files: ['*.{htm,html}'],
processor: '@nice-move/html/html',
plugins: {
'@nice-move/html': plugin
}
},
{
files: ['**/*.{htm,html}/**/html-script-legacy.js'],
parserOptions: {
sourceType: 'script'
}
},
{
files: ['**/*.{htm,html}/**/html-script-module.js'],
parserOptions: {
sourceType: 'module'
}
}
];
export default config;@nice-move/eslint-plugin-html using processor to treat <script> and <script type="module"> differently.
See: BenoitZugmeyer/eslint-plugin-html#139
And @nice-move/eslint-plugin-html is bundle-able.
When using Eslint for VS Code, you may need to add following code to settings:
See: import-js/eslint-plugin-import#2407
<script>
import 'http://something';
console.log('this example trigger error');
</script>See: Reason why
| Back | FazBrowse Home | New Git URL |