Skip to content

Commit 6b37df9

Browse files
committed
test: add tests for recommended rule set
1 parent d010853 commit 6b37df9

14 files changed

+1644
-39
lines changed

README.md

+19-16
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,31 @@ Install the config along with its peer dependencies, `eslint` and `prettier`:
1212
npm install -D eslint-config-scratch eslint@^9 prettier@^3
1313
```
1414

15-
Add `eslint.config.mjs` to your project root and, optionally, configure parser options for rules that require type
16-
information:
15+
Add `eslint.config.mjs` to your project root.
16+
17+
For a TypeScript project, you can add `languageOptions` to enable type checking:
1718

1819
```js
1920
// myProjectRoot/eslint.config.mjs
2021
import { eslintConfigScratch } from 'eslint-config-scratch'
2122

22-
// for plain JavaScript:
23-
export default eslintConfigScratch.recommended
24-
25-
// for a TypeScript project:
26-
export default eslintConfigScratch.config(
27-
eslintConfigScratch.recommended,
28-
{
29-
languageOptions: {
30-
parserOptions: {
31-
projectService: true,
32-
tsconfigRootDir: import.meta.dirname,
33-
},
34-
}
23+
export default eslintConfigScratch.config(eslintConfigScratch.recommended, {
24+
languageOptions: {
25+
parserOptions: {
26+
projectService: true,
27+
tsconfigRootDir: import.meta.dirname,
28+
},
3529
},
36-
)
30+
})
31+
```
32+
33+
For a JavaScript project, it might look like this:
34+
35+
```js
36+
// myProjectRoot/eslint.config.mjs
37+
import { eslintConfigScratch } from 'eslint-config-scratch'
38+
39+
export default eslintConfigScratch.recommended
3740
```
3841

3942
The function `eslintConfigScratch.config` is a re-export of the `config` function from `typescript-eslint`, and helps

eslint.config.mjs

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
import { globalIgnores } from 'eslint/config'
12
import globals from 'globals'
23
import { eslintConfigScratch } from './lib/index.mjs'
34

4-
export default eslintConfigScratch.config(eslintConfigScratch.recommended, {
5-
languageOptions: {
6-
globals: globals.node,
5+
export default eslintConfigScratch.config(
6+
eslintConfigScratch.recommended,
7+
{
8+
languageOptions: {
9+
globals: globals.node,
10+
},
711
},
8-
})
12+
globalIgnores(['test/**/*.bad.*']),
13+
)

0 commit comments

Comments
 (0)