ESLint plugin to lint script tags in HTML
npm install @nice-move/eslint-plugin-html[ESLint] plugin to lint script tags in HTML.
[![npm][npm-badge]][npm-url]
[![github][github-badge]][github-url]
![node][node-badge]
[eslint]: https://eslint.org/
[npm-url]: https://www.npmjs.com/package/@nice-move/eslint-plugin-html
[npm-badge]: https://img.shields.io/npm/v/@nice-move/eslint-plugin-html.svg?style=flat-square&logo=npm
[github-url]: https://github.com/nice-move/eslint-plugin-html
[github-badge]: https://img.shields.io/npm/l/@nice-move/eslint-plugin-html.svg?style=flat-square&colorB=blue&logo=github
[node-badge]: https://img.shields.io/node/v/@nice-move/eslint-plugin-html.svg?style=flat-square&colorB=green&logo=node.js
``bash`
npm install @nice-move/eslint-plugin-html --save-dev
`cjs
// 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'
}
}
]
};
`
`mjs
// 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;
`
- [ ] SVG support
@nice-move/eslint-plugin-html using processor to treat
``
See: Reason why