@w0s/eslint-config 9.2.0 → 9.3.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 +50 -49
- package/eslint.config.js +122 -97
- package/package.json +7 -6
- package/rules/functional.js +55 -0
package/README.md
CHANGED
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
# eslint-config
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@w0s/eslint-config)
|
|
4
|
-
[](https://github.com/SaekiTominaga/w0s/actions/workflows/eslint.yml)
|
|
5
|
-
|
|
6
|
-
ESLint configuration file used on my personal website ([`w0s.jp`](https://github.com/SaekiTominaga/w0s.jp)).
|
|
7
|
-
|
|
8
|
-
## Base rules & plugins
|
|
9
|
-
|
|
10
|
-
### All files (Vanilla JavaScript, etc.)
|
|
11
|
-
|
|
12
|
-
- [eslint
|
|
13
|
-
- [eslint-plugin-
|
|
14
|
-
- [eslint-plugin-
|
|
15
|
-
- [eslint-plugin-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- [@typescript-eslint/eslint-plugin
|
|
22
|
-
- [eslint-plugin-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
import
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
# eslint-config
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@w0s/eslint-config)
|
|
4
|
+
[](https://github.com/SaekiTominaga/w0s/actions/workflows/eslint.yml)
|
|
5
|
+
|
|
6
|
+
ESLint configuration file used on my personal website ([`w0s.jp`](https://github.com/SaekiTominaga/w0s.jp)).
|
|
7
|
+
|
|
8
|
+
## Base rules & plugins
|
|
9
|
+
|
|
10
|
+
### All files (Vanilla JavaScript, etc.)
|
|
11
|
+
|
|
12
|
+
- [eslint](https://eslint.org/): recommended
|
|
13
|
+
- [eslint-plugin-functional](https://github.com/eslint-functional/eslint-plugin-functional): externalVanillaRecommended, recommended, stylistic
|
|
14
|
+
- [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import): recommended
|
|
15
|
+
- [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc): recommended
|
|
16
|
+
- [eslint-plugin-safely-storage](https://github.com/SaekiTominaga/eslint-plugin/tree/main/packages/safely-storage)
|
|
17
|
+
- and, some customizations
|
|
18
|
+
|
|
19
|
+
### TypeScript
|
|
20
|
+
|
|
21
|
+
- [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/): strict-type-checked, stylistic-type-checked
|
|
22
|
+
- [eslint-plugin-functional](https://github.com/eslint-functional/eslint-plugin-functional): externalTypeScriptRecommended, recommended, stylistic
|
|
23
|
+
- [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc/): recommended-typescript
|
|
24
|
+
- and, some customizations
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import w0sConfig from '@w0s/eslint-config';
|
|
30
|
+
|
|
31
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
32
|
+
export default [
|
|
33
|
+
...w0sConfig,
|
|
34
|
+
{
|
|
35
|
+
// other options
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
or
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
import { defineConfig } from 'eslint/config';
|
|
44
|
+
import w0sConfig from '@w0s/eslint-config';
|
|
45
|
+
|
|
46
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
47
|
+
export default defineConfig(w0sConfig, {
|
|
48
|
+
// other options
|
|
49
|
+
});
|
|
50
|
+
```
|
package/eslint.config.js
CHANGED
|
@@ -1,97 +1,122 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { defineConfig } from 'eslint/config';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import tseslint from 'typescript-eslint';
|
|
11
|
-
import eslint from '@eslint/js';
|
|
12
|
-
import configEslintLayoutFormatting from './rules/eslint/layout&formatting.js';
|
|
13
|
-
import configEslintPossibleProblems from './rules/eslint/possible-problems.js';
|
|
14
|
-
import configEslintSuggestions from './rules/eslint/suggestions.js';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
'@typescript-eslint/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
/* eslint-disable import/no-unresolved */
|
|
3
|
+
|
|
4
|
+
import { defineConfig } from 'eslint/config';
|
|
5
|
+
import pluginFunctional from 'eslint-plugin-functional';
|
|
6
|
+
import pluginImport from 'eslint-plugin-import';
|
|
7
|
+
import { jsdoc as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
8
|
+
import pluginSafelyStorage from 'eslint-plugin-safely-storage';
|
|
9
|
+
import globals from 'globals';
|
|
10
|
+
import tseslint from 'typescript-eslint';
|
|
11
|
+
import eslint from '@eslint/js';
|
|
12
|
+
import configEslintLayoutFormatting from './rules/eslint/layout&formatting.js';
|
|
13
|
+
import configEslintPossibleProblems from './rules/eslint/possible-problems.js';
|
|
14
|
+
import configEslintSuggestions from './rules/eslint/suggestions.js';
|
|
15
|
+
import configFunctional from './rules/functional.js';
|
|
16
|
+
import configImport from './rules/import.js';
|
|
17
|
+
import configJsdoc from './rules/jsdoc.js';
|
|
18
|
+
|
|
19
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
20
|
+
export default defineConfig(
|
|
21
|
+
eslint.configs.recommended,
|
|
22
|
+
configEslintPossibleProblems,
|
|
23
|
+
configEslintSuggestions,
|
|
24
|
+
configEslintLayoutFormatting,
|
|
25
|
+
|
|
26
|
+
/* Plugins */
|
|
27
|
+
pluginImport.flatConfigs.recommended,
|
|
28
|
+
configImport,
|
|
29
|
+
|
|
30
|
+
pluginJsdoc({ config: 'flat/recommended' }),
|
|
31
|
+
configJsdoc,
|
|
32
|
+
|
|
33
|
+
pluginSafelyStorage.configs.default,
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
files: ['**/*.js'],
|
|
37
|
+
languageOptions: {
|
|
38
|
+
ecmaVersion: 'latest', // デフォルト値は 'latest' だが明示的な指定が必要
|
|
39
|
+
globals: globals.nodeBuiltin,
|
|
40
|
+
},
|
|
41
|
+
extends: [
|
|
42
|
+
pluginFunctional.configs.externalVanillaRecommended,
|
|
43
|
+
pluginFunctional.configs.recommended,
|
|
44
|
+
pluginFunctional.configs.stylistic,
|
|
45
|
+
pluginFunctional.configs.disableTypeChecked,
|
|
46
|
+
],
|
|
47
|
+
rules: {
|
|
48
|
+
...configFunctional.rules,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
files: ['**/*.ts'],
|
|
53
|
+
languageOptions: {
|
|
54
|
+
parserOptions: {
|
|
55
|
+
project: true,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
extends: [
|
|
59
|
+
tseslint.configs.strictTypeChecked,
|
|
60
|
+
tseslint.configs.stylisticTypeChecked,
|
|
61
|
+
pluginFunctional.configs.externalTypeScriptRecommended,
|
|
62
|
+
pluginFunctional.configs.recommended,
|
|
63
|
+
pluginFunctional.configs.stylistic,
|
|
64
|
+
pluginJsdoc({ config: 'flat/recommended-typescript' }),
|
|
65
|
+
],
|
|
66
|
+
rules: {
|
|
67
|
+
'dot-notation': 'off',
|
|
68
|
+
'no-unused-vars': 'off',
|
|
69
|
+
...configFunctional.rules,
|
|
70
|
+
'import/extensions': [
|
|
71
|
+
'error',
|
|
72
|
+
'ignorePackages',
|
|
73
|
+
{
|
|
74
|
+
js: 'never',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
'import/no-unresolved': 'off',
|
|
78
|
+
'@typescript-eslint/no-unused-vars': [
|
|
79
|
+
'error',
|
|
80
|
+
{
|
|
81
|
+
caughtErrors: 'none',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
'@typescript-eslint/strict-boolean-expressions': [
|
|
85
|
+
'error',
|
|
86
|
+
{
|
|
87
|
+
allowNullableBoolean: true,
|
|
88
|
+
allowNullableObject: false,
|
|
89
|
+
allowNumber: false,
|
|
90
|
+
allowString: false,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
'@typescript-eslint/switch-exhaustiveness-check': [
|
|
94
|
+
'error',
|
|
95
|
+
{
|
|
96
|
+
considerDefaultExhaustiveForUnions: true,
|
|
97
|
+
},
|
|
98
|
+
], // eslint-plugin-functional; externalTypeScriptRecommended
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
files: ['**/*.config.js'],
|
|
103
|
+
rules: {
|
|
104
|
+
'import/no-extraneous-dependencies': 'off',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
files: ['**/*.test.js', '**/*.test.ts'],
|
|
109
|
+
rules: {
|
|
110
|
+
'no-new': 'off',
|
|
111
|
+
'no-unused-expressions': 'off',
|
|
112
|
+
'import/no-extraneous-dependencies': 'off',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
files: ['**/*.test.ts'],
|
|
117
|
+
rules: {
|
|
118
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
119
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w0s/eslint-config",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "ESLint configuration file used on `w0s.jp`",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -25,16 +25,17 @@
|
|
|
25
25
|
"lint": "eslint __tests__/valid/**/*.{js,ts} __tests__/*.test.js rules/**/*.js eslint.config.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@eslint/js": "^9.
|
|
28
|
+
"@eslint/js": "^9.39.1",
|
|
29
|
+
"eslint-plugin-functional": "^9.0.2",
|
|
29
30
|
"eslint-plugin-import": "^2.32.0",
|
|
30
|
-
"eslint-plugin-jsdoc": "^
|
|
31
|
+
"eslint-plugin-jsdoc": "^61.2.1",
|
|
31
32
|
"eslint-plugin-safely-storage": "^1.0.2",
|
|
32
33
|
"globals": "^16.4.0",
|
|
33
|
-
"typescript-eslint": "^8.46.
|
|
34
|
+
"typescript-eslint": "^8.46.4"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^24.
|
|
37
|
-
"eslint": "^9.
|
|
37
|
+
"@types/node": "^24.10.1",
|
|
38
|
+
"eslint": "^9.39.1"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"eslint": "^9.35.0"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/lines-before-block */
|
|
2
|
+
|
|
3
|
+
/** @type {import("eslint").Linter.Config} */
|
|
4
|
+
export default {
|
|
5
|
+
rules: {
|
|
6
|
+
/**
|
|
7
|
+
* Currying
|
|
8
|
+
*/
|
|
9
|
+
'functional/functional-parameters': [
|
|
10
|
+
'error',
|
|
11
|
+
{
|
|
12
|
+
enforceParameterCount: false,
|
|
13
|
+
},
|
|
14
|
+
] /* ☑️ ✅ 🔒 */,
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* No Exceptions
|
|
18
|
+
*/
|
|
19
|
+
/* no-promise-reject */
|
|
20
|
+
'functional/no-throw-statements': 'off' /* ☑️ ✅ 🔒 */,
|
|
21
|
+
/* 🔒 no-try-statements */
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* No Mutations
|
|
25
|
+
*/
|
|
26
|
+
'functional/immutable-data': 'off' /* ☑️ ✅ 🔒 */,
|
|
27
|
+
'functional/no-let': 'off' /* ☑️ ✅ 🔒 */,
|
|
28
|
+
'functional/prefer-immutable-types': 'off' /* ☑️ ✅ 🔒 */,
|
|
29
|
+
/* [❌ Deprecated] prefer-readonly-type */
|
|
30
|
+
/* ☑️ ✅ 🔒 type-declaration-immutability */
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* No Other Paradigms
|
|
34
|
+
*/
|
|
35
|
+
'functional/no-class-inheritance': 'off' /* ☑️ ✅ 🔒 */,
|
|
36
|
+
'functional/no-classes': 'off' /* ✅ 🔒 */,
|
|
37
|
+
/* ☑️ ✅ 🔒 no-mixed-types */
|
|
38
|
+
/* 🔒 no-this-expressions */
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* No Statements
|
|
42
|
+
*/
|
|
43
|
+
'functional/no-conditional-statements': 'off' /* ✅ 🔒 */,
|
|
44
|
+
'functional/no-expression-statements': 'off' /* ✅ 🔒 */,
|
|
45
|
+
/* ☑️ ✅ 🔒 no-loop-statements */
|
|
46
|
+
'functional/no-return-void': 'off' /* ☑️ ✅ 🔒 */,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Stylistic
|
|
50
|
+
*/
|
|
51
|
+
/* 🎨 prefer-property-signatures */
|
|
52
|
+
/* 🎨(⚠️) prefer-tacit */
|
|
53
|
+
/* 🎨 readonly-type */
|
|
54
|
+
},
|
|
55
|
+
};
|