2.0.1 • Published 1 year ago
@babybeet/eslint-config-base-with-vitest v2.0.1
eslint-config-base-with-vitest 
Base ESLint rules with support for linting Vitest test files.
ESLint compatibility
| This library | ESLint |
|---|---|
| 2.x.x | ^9 |
| 1.x.x | ^8 |
Installation
npmnpm i -S @babybeet/eslint-config-base-with-vitestpnpmpnpm i -S @babybeet/eslint-config-base-with-vitestyarnyarn add @babybeet/eslint-config-base-with-vitest
ESLint 9
eslint.config.js file
import baseConfig from '@babybeet/eslint-config-base-with-vitest';
/**
* @type {import('eslint').Linter.FlatConfig[]}
*/
export default [
...baseConfig.map(config => ({
...config,
files: ['src/**/*.ts'], // Only lint Typescript files under `src` directory.
rules: {
...config.rules
// Your rule overrides go here
}
}))
];If your package.json file has "type": "module", you can change the above require and module.exports to import and export default respectively.
ESLint 8
.eslintrc.json file
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"root": true,
"ignorePatterns": ["!**/*"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
// It's recommended to use an override to not globally change your ESLint configuration.
"overrides": [
{
"files": ["*.ts"],
"extends": ["@babybeet/eslint-config-base-with-vitest"],
"rules": {
// Your rule overrides go here
}
}
]
}