@w0s/eslint-config 9.1.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 CHANGED
@@ -9,17 +9,18 @@ ESLint configuration file used on my personal website ([`w0s.jp`](https://github
9
9
 
10
10
  ### All files (Vanilla JavaScript, etc.)
11
11
 
12
- - [eslint:recommended](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#using-eslintrecommended)
13
- - [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import):recommended
14
- - [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc):recommended
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
15
16
  - [eslint-plugin-safely-storage](https://github.com/SaekiTominaga/eslint-plugin/tree/main/packages/safely-storage)
16
17
  - and, some customizations
17
18
 
18
19
  ### TypeScript
19
20
 
20
- - [@typescript-eslint/eslint-plugin:strict-type-checked](https://typescript-eslint.io/users/configs/#strict-type-checked)
21
- - [@typescript-eslint/eslint-plugin:stylistic-type-checked](https://typescript-eslint.io/users/configs/#stylistic-type-checked)
22
- - [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc/):recommended-typescript
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
23
24
  - and, some customizations
24
25
 
25
26
  ## Usage
package/eslint.config.js CHANGED
@@ -1,20 +1,22 @@
1
1
  // @ts-check
2
+ /* eslint-disable import/no-unresolved */
2
3
 
3
- // eslint-disable-next-line import/no-unresolved
4
4
  import { defineConfig } from 'eslint/config';
5
+ import pluginFunctional from 'eslint-plugin-functional';
5
6
  import pluginImport from 'eslint-plugin-import';
6
7
  import { jsdoc as pluginJsdoc } from 'eslint-plugin-jsdoc';
7
8
  import pluginSafelyStorage from 'eslint-plugin-safely-storage';
8
9
  import globals from 'globals';
9
- // eslint-disable-next-line import/no-unresolved
10
10
  import tseslint from 'typescript-eslint';
11
11
  import eslint from '@eslint/js';
12
12
  import configEslintLayoutFormatting from './rules/eslint/layout&formatting.js';
13
13
  import configEslintPossibleProblems from './rules/eslint/possible-problems.js';
14
14
  import configEslintSuggestions from './rules/eslint/suggestions.js';
15
+ import configFunctional from './rules/functional.js';
15
16
  import configImport from './rules/import.js';
16
17
  import configJsdoc from './rules/jsdoc.js';
17
18
 
19
+ /** @type {import("eslint").Linter.Config[]} */
18
20
  export default defineConfig(
19
21
  eslint.configs.recommended,
20
22
  configEslintPossibleProblems,
@@ -36,6 +38,15 @@ export default defineConfig(
36
38
  ecmaVersion: 'latest', // デフォルト値は 'latest' だが明示的な指定が必要
37
39
  globals: globals.nodeBuiltin,
38
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
+ },
39
50
  },
40
51
  {
41
52
  files: ['**/*.ts'],
@@ -44,10 +55,18 @@ export default defineConfig(
44
55
  project: true,
45
56
  },
46
57
  },
47
- extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked, pluginJsdoc({ config: 'flat/recommended-typescript' })],
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
+ ],
48
66
  rules: {
49
67
  'dot-notation': 'off',
50
68
  'no-unused-vars': 'off',
69
+ ...configFunctional.rules,
51
70
  'import/extensions': [
52
71
  'error',
53
72
  'ignorePackages',
@@ -71,6 +90,12 @@ export default defineConfig(
71
90
  allowString: false,
72
91
  },
73
92
  ],
93
+ '@typescript-eslint/switch-exhaustiveness-check': [
94
+ 'error',
95
+ {
96
+ considerDefaultExhaustiveForUnions: true,
97
+ },
98
+ ], // eslint-plugin-functional; externalTypeScriptRecommended
74
99
  },
75
100
  },
76
101
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w0s/eslint-config",
3
- "version": "9.1.0",
3
+ "version": "9.3.0",
4
4
  "description": "ESLint configuration file used on `w0s.jp`",
5
5
  "keywords": [
6
6
  "eslint",
@@ -25,19 +25,20 @@
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.35.0",
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": "^57.0.8",
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.43.0"
34
+ "typescript-eslint": "^8.46.4"
34
35
  },
35
36
  "devDependencies": {
36
- "@types/node": "^24.4.0",
37
- "eslint": "^9.35.0"
37
+ "@types/node": "^24.10.1",
38
+ "eslint": "^9.39.1"
38
39
  },
39
40
  "peerDependencies": {
40
- "eslint": "^9.23.0"
41
+ "eslint": "^9.35.0"
41
42
  },
42
43
  "publishConfig": {
43
44
  "access": "public"
@@ -10,6 +10,7 @@ export default {
10
10
  'no-await-in-loop': 'error', // eslint-config-airbnb-base@15.0.0; errors
11
11
  'no-cond-assign': ['error', 'always'], // eslint-config-airbnb-base@15.0.0; errors
12
12
  'no-console': 'warn', // eslint-config-airbnb-base@15.0.0; errors
13
+ 'no-continue': 'error', // eslint-config-airbnb-base@15.0.0; style
13
14
  'no-constructor-return': 'error', // eslint-config-airbnb-base@15.0.0; best-practices
14
15
  'no-irregular-whitespace': [
15
16
  'error',
@@ -22,6 +23,7 @@ export default {
22
23
  'no-promise-executor-return': 'error', // eslint-config-airbnb-base@15.0.0; errors
23
24
  'no-self-compare': 'error', // eslint-config-airbnb-base@15.0.0; best-practices
24
25
  'no-template-curly-in-string': 'error', // eslint-config-airbnb-base@15.0.0; errors
26
+ 'no-unassigned-vars': 'error', // ESLint 10 recommended candidate https://github.com/eslint/eslint/issues/19966
25
27
  'no-unmodified-loop-condition': 'error',
26
28
  'no-unsafe-optional-chaining': [
27
29
  'error',
@@ -35,6 +37,7 @@ export default {
35
37
  caughtErrors: 'none',
36
38
  },
37
39
  ],
40
+ 'no-useless-assignment': 'error', // ESLint 10 recommended candidate https://github.com/eslint/eslint/issues/19966
38
41
  'valid-typeof': [
39
42
  'error',
40
43
  {
@@ -28,7 +28,6 @@ export default {
28
28
  'no-array-constructor': 'error', // eslint-config-airbnb-base@15.0.0; style
29
29
  'no-bitwise': 'error', // eslint-config-airbnb-base@15.0.0; style
30
30
  'no-caller': 'error', // eslint-config-airbnb-base@15.0.0; best-practices
31
- 'no-continue': 'error', // eslint-config-airbnb-base@15.0.0; style
32
31
  'no-else-return': 'error',
33
32
  'no-empty': [
34
33
  'error',
@@ -138,6 +137,7 @@ export default {
138
137
  'prefer-rest-params': 'error', // eslint-config-airbnb-base@15.0.0; es6
139
138
  'prefer-spread': 'error', // eslint-config-airbnb-base@15.0.0; es6
140
139
  'prefer-template': 'error', // eslint-config-airbnb-base@15.0.0; es6
140
+ 'preserve-caught-error': 'error', // ESLint 10 recommended candidate https://github.com/eslint/eslint/issues/19966
141
141
  radix: 'error', // eslint-config-airbnb-base@15.0.0; best-practices
142
142
  'require-await': 'error',
143
143
  'require-unicode-regexp': 'error',
@@ -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
+ };