3.1.0 • Published 12 months ago
eslint-config-tjw-base v3.1.0
eslint-config-tjw-base
The Jared Wilcurt's base ESLint 9+ rules for ESM projects.
For CJS and ESLint < v9, use v2.x releases.
Using this
- If you don't have a
package.jsondonpm init -yfirst - Run
npm pkg set type=module - Run
npm install --save-dev eslint eslint-config-tjw-base @stylistic/eslint-plugin-js In your
eslint.config.jsaddtjwBaseto your config like so:import js from '@eslint/js'; import tjwBase from 'eslint-config-tjw-base'; export default [ js.configs.recommended, tjwBase, { // project specific settings } ];Run
npm pkg set scripts.lint="eslint *.js src"- Change
*.js srcto your files and folders you want to be linted
- Change
- Run
npm run lint
If you already have a no-restricted-syntax rule, you can merge the ones that come with this config with your own, like so:
// eslint.config.js
import js from '@eslint/js';
import baseRestrictedSyntax from 'eslint-config-tjw-base/no-restricted-syntax.js';
import tjwBase from 'eslint-config-tjw-base';
export default [
js.configs.recommended,
tjwBase,
{
rules: {
'no-restricted-syntax': [
'error',
...baseRestrictedSyntax,
// your custom rules
]
}
}
];See also: