An ESLint plugin for linting inline scripts in Pug files!
Only extracts script tags with no type or text/javascript type.
See also: eslint-plugin-html.
Install with npm, obviously:
npm install --save-dev eslint eslint-plugin-pugAnd add to your ESLint configuration -- eslint.config.js:
// eslint.config.js
import { defineConfig } from 'eslint/config';
import pug from 'eslint-plugin-pug';
export default defineConfig([
// ... other configs
{
name: 'eslint-plugin-pug/processor',
files: ['**/*.pug', '**/*.jade'], // apply processor to .pug, .jade files
plugins: { pug },
processor: 'pug/pug',
},
{
name: 'eslint-plugin-pug/rules',
files: ['**/*.pug.mjs', '**/*.pug.js'], // apply rules to virtual .pug.mjs, .pug.js files created by the processor
rules: {
'@stylistic/eol-last': ['error', 'never'],
// ... other rules
},
},
]);And add to your ESLint configuration -- .eslintrc or eslintConfig in package.json:
{
"plugins": [
"pug"
]
}Please feel free to submit pull requests!
By participating in this project you agree to follow the Contributor Code of Conduct and to release your contributions under the Unlicense.
This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE file or unlicense.org.