eslint-config-tamia 9.3.0 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +8 -6
- package/index.mjs +3 -1
- package/package.json +12 -6
- package/react.mjs +3 -1
- package/rules/misc.mjs +13 -0
- package/rules/unicorn.mjs +0 -3
- package/rules/vitest.mjs +26 -0
- package/typescript-react.mjs +10 -1
- package/typescript.mjs +3 -1
package/Readme.md
CHANGED
|
@@ -6,15 +6,20 @@ This package provides a shared ESLint config that I use on all my projects.
|
|
|
6
6
|
|
|
7
7
|
**Should be used with [Prettier](https://prettier.io/), has no own code style rules.**
|
|
8
8
|
|
|
9
|
+
All presets include the following ESLint plugins:
|
|
10
|
+
|
|
11
|
+
- [@eslint-community/eslint-plugin-eslint-comments](https://eslint-community.github.io/eslint-plugin-eslint-comments/)
|
|
12
|
+
- [eslint-plugin-de-morgan](https://github.com/azat-io/eslint-plugin-de-morgan)
|
|
13
|
+
- [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
14
|
+
- [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest)
|
|
15
|
+
|
|
9
16
|
## Usage
|
|
10
17
|
|
|
11
18
|
We export three ESLint configurations:
|
|
12
19
|
|
|
13
20
|
### eslint-config-tamia
|
|
14
21
|
|
|
15
|
-
Base set of rules for JavaScript.
|
|
16
|
-
|
|
17
|
-
- [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
22
|
+
Base set of rules for JavaScript.
|
|
18
23
|
|
|
19
24
|
`npm install --save-dev eslint eslint-config-tamia`
|
|
20
25
|
|
|
@@ -30,7 +35,6 @@ export default [...tamia];
|
|
|
30
35
|
Lints ES6+ and React. Includes:
|
|
31
36
|
|
|
32
37
|
- [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react)
|
|
33
|
-
- [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
34
38
|
|
|
35
39
|
`npm install --save-dev eslint eslint-config-tamia`
|
|
36
40
|
|
|
@@ -46,7 +50,6 @@ export default [...tamiaReact];
|
|
|
46
50
|
Lints TypeScript. Includes:
|
|
47
51
|
|
|
48
52
|
- [typescript-eslint](https://typescript-eslint.io/)
|
|
49
|
-
- [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
50
53
|
|
|
51
54
|
`npm install --save-dev eslint eslint-config-tamia`
|
|
52
55
|
|
|
@@ -63,7 +66,6 @@ Lints TypeScript and React. Includes:
|
|
|
63
66
|
|
|
64
67
|
- [typescript-eslint](https://typescript-eslint.io/)
|
|
65
68
|
- [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react)
|
|
66
|
-
- [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
67
69
|
|
|
68
70
|
`npm install --save-dev eslint eslint-config-tamia eslint-plugin-jsx-a11y`
|
|
69
71
|
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import javascript from './rules/javascript.mjs';
|
|
2
|
+
import misc from './rules/misc.mjs';
|
|
2
3
|
import unicorn from './rules/unicorn.mjs';
|
|
4
|
+
import vitest from './rules/vitest.mjs';
|
|
3
5
|
|
|
4
6
|
/** @type { import("eslint").Linter.FlatConfig[] } */
|
|
5
|
-
export default [...javascript, ...unicorn];
|
|
7
|
+
export default [...javascript, ...unicorn, ...vitest, ...misc];
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-tamia",
|
|
3
3
|
"description": "Tâmia ESLint config",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.4.0",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22"
|
|
7
|
+
},
|
|
5
8
|
"type": "module",
|
|
6
9
|
"main": "index.mjs",
|
|
7
10
|
"exports": {
|
|
@@ -51,10 +54,13 @@
|
|
|
51
54
|
"eslint": ">=9.7"
|
|
52
55
|
},
|
|
53
56
|
"dependencies": {
|
|
54
|
-
"@eslint/
|
|
55
|
-
"eslint
|
|
56
|
-
"eslint-plugin
|
|
57
|
-
"
|
|
58
|
-
"
|
|
57
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
|
|
58
|
+
"@eslint/js": "9.36.0",
|
|
59
|
+
"@vitest/eslint-plugin": "1.3.16",
|
|
60
|
+
"eslint-plugin-de-morgan": "2.0.0",
|
|
61
|
+
"eslint-plugin-react": "7.37.5",
|
|
62
|
+
"eslint-plugin-unicorn": "61.0.2",
|
|
63
|
+
"globals": "16.4.0",
|
|
64
|
+
"typescript-eslint": "8.44.1"
|
|
59
65
|
}
|
|
60
66
|
}
|
package/react.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import javascript from './rules/javascript.mjs';
|
|
2
|
+
import misc from './rules/misc.mjs';
|
|
2
3
|
import react from './rules/react.mjs';
|
|
3
4
|
import unicorn from './rules/unicorn.mjs';
|
|
5
|
+
import vitest from './rules/vitest.mjs';
|
|
4
6
|
|
|
5
7
|
/** @type { import("eslint").Linter.FlatConfig[] } */
|
|
6
|
-
export default [...javascript, ...react, ...unicorn];
|
|
8
|
+
export default [...javascript, ...react, ...unicorn, ...vitest, ...misc];
|
package/rules/misc.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import comments from '@eslint-community/eslint-plugin-eslint-comments/configs';
|
|
2
|
+
import deMorgan from 'eslint-plugin-de-morgan';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
// Disallows useless ESLint disable comments, etc.
|
|
6
|
+
comments.recommended,
|
|
7
|
+
// Enforces logical consistency by transforming negated boolean expressions
|
|
8
|
+
// according to De Morgan’s laws
|
|
9
|
+
deMorgan.configs.recommended,
|
|
10
|
+
{
|
|
11
|
+
rules: {},
|
|
12
|
+
},
|
|
13
|
+
];
|
package/rules/unicorn.mjs
CHANGED
|
@@ -10,9 +10,6 @@ export default [
|
|
|
10
10
|
// This breaks a lot of code, like `typeof window` to detect that we're in
|
|
11
11
|
// the browser
|
|
12
12
|
'unicorn/prefer-global-this': 'off',
|
|
13
|
-
// Prefer reading a JSON file as a buffer. Buffers can be passed directly to
|
|
14
|
-
// JSON.parse()
|
|
15
|
-
'unicorn/prefer-json-parse-buffer': 'error',
|
|
16
13
|
// Set.has() might be faster than Array.includes() but who cares if the array
|
|
17
14
|
// is short. Set is less readable
|
|
18
15
|
'unicorn/prefer-set-has': 'off',
|
package/rules/vitest.mjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import vitest from '@vitest/eslint-plugin';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
...vitest.configs.recommended,
|
|
6
|
+
files: ['**/*.{spec,test}.*'],
|
|
7
|
+
rules: {
|
|
8
|
+
// Consistently use *.test.ts instead of .spec.ts
|
|
9
|
+
'vitest/consistent-test-filename': [
|
|
10
|
+
'error',
|
|
11
|
+
{ pattern: String.raw`.*\.test\.[tj]sx?$` },
|
|
12
|
+
],
|
|
13
|
+
// Consistently use test() instead of it()
|
|
14
|
+
'test/consistent-test-it': [
|
|
15
|
+
'error',
|
|
16
|
+
{ fn: 'test', withinDescribe: 'test' },
|
|
17
|
+
],
|
|
18
|
+
// Consistently use vi.* instead of vitest.*
|
|
19
|
+
'vitest/consistent-vitest-vi': 'error',
|
|
20
|
+
// Disallow focused tests such as test.only()
|
|
21
|
+
'vitest/no-focused-tests': 'error',
|
|
22
|
+
// Enforce padding around vitest functions
|
|
23
|
+
'vitest/padding-around-all': 'warn',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
package/typescript-react.mjs
CHANGED
|
@@ -2,6 +2,15 @@ import javascript from './rules/javascript.mjs';
|
|
|
2
2
|
import typescript from './rules/typescript.mjs';
|
|
3
3
|
import react from './rules/react.mjs';
|
|
4
4
|
import unicorn from './rules/unicorn.mjs';
|
|
5
|
+
import misc from './rules/misc.mjs';
|
|
6
|
+
import vitest from './rules/vitest.mjs';
|
|
5
7
|
|
|
6
8
|
/** @type { import("eslint").Linter.FlatConfig[] } */
|
|
7
|
-
export default [
|
|
9
|
+
export default [
|
|
10
|
+
...javascript,
|
|
11
|
+
...typescript,
|
|
12
|
+
...react,
|
|
13
|
+
...unicorn,
|
|
14
|
+
...vitest,
|
|
15
|
+
...misc,
|
|
16
|
+
];
|
package/typescript.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import javascript from './rules/javascript.mjs';
|
|
2
|
+
import misc from './rules/misc.mjs';
|
|
2
3
|
import typescript from './rules/typescript.mjs';
|
|
3
4
|
import unicorn from './rules/unicorn.mjs';
|
|
5
|
+
import vitest from './rules/vitest.mjs';
|
|
4
6
|
|
|
5
7
|
/** @type { import("eslint").Linter.FlatConfig[] } */
|
|
6
|
-
export default [...javascript, ...typescript, ...unicorn];
|
|
8
|
+
export default [...javascript, ...typescript, ...unicorn, ...vitest, ...misc];
|