https://github.com/lazycuh/eslint-config-base-with-vitest
Base ESLint rules with support for linting Vitest test files
https://github.com/lazycuh/eslint-config-base-with-vitest
Last synced: 6 months ago
JSON representation
Base ESLint rules with support for linting Vitest test files
- Host: GitHub
- URL: https://github.com/lazycuh/eslint-config-base-with-vitest
- Owner: lazycuh
- Created: 2024-06-16T04:36:37.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-07-18T07:05:52.000Z (10 months ago)
- Last Synced: 2024-11-03T17:43:25.754Z (7 months ago)
- Language: JavaScript
- Size: 303 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# eslint-config-base-with-vitest [](https://app.circleci.com/pipelines/github/lazycuh/eslint-config-base-with-vitest?branch=main)
[Base ESLint rules](https://github.com/lazycuh/eslint-config-base) with support for linting Vitest test files.
## ESLint compatibility
| This library | ESLint |
| ------------ | ------ |
| 2.x.x | ^9 |
| 1.x.x | ^8 |## Installation
- `npm`
```
npm i -S @lazycuh/eslint-config-base-with-vitest
```
- `pnpm`
```
pnpm i -S @lazycuh/eslint-config-base-with-vitest
```
- `yarn````
yarn add @lazycuh/eslint-config-base-with-vitest
```### ESLint 9
`eslint.config.js` file
```js
import baseConfig from '@lazycuh/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
```json
{
"$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": ["@lazycuh/eslint-config-base-with-vitest"],
"rules": {
// Your rule overrides go here
}
}
]
}
```