@w0s/eslint-config 8.6.0 → 9.0.1
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 +49 -32
- package/eslint.config.js +17 -17
- package/package.json +8 -8
- package/rules/eslint/possible-problems.js +45 -39
package/README.md
CHANGED
|
@@ -1,32 +1,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
|
-
|
|
11
|
-
|
|
12
|
-
- [eslint
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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: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
|
|
15
|
+
- [eslint-plugin-safely-storage](https://github.com/SaekiTominaga/eslint-plugin/tree/main/packages/safely-storage)
|
|
16
|
+
- and, some customizations
|
|
17
|
+
|
|
18
|
+
### TypeScript
|
|
19
|
+
|
|
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
|
|
23
|
+
- and, some customizations
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
import w0sConfig from '@w0s/eslint-config';
|
|
29
|
+
|
|
30
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
31
|
+
export default [
|
|
32
|
+
...w0sConfig,
|
|
33
|
+
{
|
|
34
|
+
// other options
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
or
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
import { defineConfig } from 'eslint/config';
|
|
43
|
+
import w0sConfig from '@w0s/eslint-config';
|
|
44
|
+
|
|
45
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
46
|
+
export default defineConfig(w0sConfig, {
|
|
47
|
+
// other options
|
|
48
|
+
});
|
|
49
|
+
```
|
package/eslint.config.js
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/no-unresolved
|
|
4
|
+
import { defineConfig } from 'eslint/config';
|
|
1
5
|
import pluginImport from 'eslint-plugin-import';
|
|
2
|
-
import pluginJsdoc from 'eslint-plugin-jsdoc';
|
|
6
|
+
import { jsdoc as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
3
7
|
import pluginSafelyStorage from 'eslint-plugin-safely-storage';
|
|
4
8
|
import globals from 'globals';
|
|
5
9
|
// eslint-disable-next-line import/no-unresolved
|
|
6
10
|
import tseslint from 'typescript-eslint';
|
|
7
|
-
import
|
|
11
|
+
import eslint from '@eslint/js';
|
|
8
12
|
import configEslintLayoutFormatting from './rules/eslint/layout&formatting.js';
|
|
9
13
|
import configEslintPossibleProblems from './rules/eslint/possible-problems.js';
|
|
10
14
|
import configEslintSuggestions from './rules/eslint/suggestions.js';
|
|
11
15
|
import configImport from './rules/import.js';
|
|
12
16
|
import configJsdoc from './rules/jsdoc.js';
|
|
13
17
|
|
|
14
|
-
export default
|
|
15
|
-
|
|
16
|
-
plugins: {
|
|
17
|
-
'@typescript-eslint': tseslint.plugin,
|
|
18
|
-
pluginJsdoc,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
eslintJs.configs.recommended,
|
|
18
|
+
export default defineConfig(
|
|
19
|
+
eslint.configs.recommended,
|
|
23
20
|
configEslintPossibleProblems,
|
|
24
21
|
configEslintSuggestions,
|
|
25
22
|
configEslintLayoutFormatting,
|
|
26
23
|
|
|
27
24
|
/* Plugins */
|
|
28
25
|
pluginImport.flatConfigs.recommended,
|
|
29
|
-
pluginJsdoc.configs['flat/recommended'],
|
|
30
|
-
...pluginSafelyStorage.configs.default,
|
|
31
26
|
configImport,
|
|
27
|
+
|
|
28
|
+
pluginJsdoc({ config: 'flat/recommended' }),
|
|
32
29
|
configJsdoc,
|
|
33
30
|
|
|
31
|
+
pluginSafelyStorage.configs.default,
|
|
32
|
+
|
|
34
33
|
{
|
|
35
34
|
files: ['**/*.js'],
|
|
36
35
|
languageOptions: {
|
|
@@ -41,16 +40,14 @@ export default tseslint.config(
|
|
|
41
40
|
{
|
|
42
41
|
files: ['**/*.ts'],
|
|
43
42
|
languageOptions: {
|
|
44
|
-
parser: tseslint.parser,
|
|
45
43
|
parserOptions: {
|
|
46
44
|
project: true,
|
|
47
|
-
tsconfigRootDir: import.meta.dirname,
|
|
48
45
|
},
|
|
49
46
|
},
|
|
50
|
-
extends: [
|
|
47
|
+
extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked, pluginJsdoc({ config: 'flat/recommended-typescript' })],
|
|
51
48
|
rules: {
|
|
52
|
-
...pluginJsdoc.configs['flat/recommended-typescript'].rules,
|
|
53
49
|
'dot-notation': 'off',
|
|
50
|
+
'no-unused-vars': 'off',
|
|
54
51
|
'import/extensions': [
|
|
55
52
|
'error',
|
|
56
53
|
'ignorePackages',
|
|
@@ -70,6 +67,9 @@ export default tseslint.config(
|
|
|
70
67
|
'error',
|
|
71
68
|
{
|
|
72
69
|
allowNullableBoolean: true,
|
|
70
|
+
allowNullableObject: false,
|
|
71
|
+
allowNumber: false,
|
|
72
|
+
allowString: false,
|
|
73
73
|
},
|
|
74
74
|
],
|
|
75
75
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w0s/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "ESLint configuration file used on `w0s.jp`",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -25,19 +25,19 @@
|
|
|
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.35.0",
|
|
29
29
|
"eslint-plugin-import": "^2.32.0",
|
|
30
|
-
"eslint-plugin-jsdoc": "^
|
|
30
|
+
"eslint-plugin-jsdoc": "^57.0.8",
|
|
31
31
|
"eslint-plugin-safely-storage": "^1.0.2",
|
|
32
|
-
"globals": "^16.
|
|
33
|
-
"typescript-eslint": "^8.
|
|
32
|
+
"globals": "^16.4.0",
|
|
33
|
+
"typescript-eslint": "^8.43.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^24.
|
|
37
|
-
"eslint": "^9.
|
|
36
|
+
"@types/node": "^24.4.0",
|
|
37
|
+
"eslint": "^9.35.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"eslint": "^9.
|
|
40
|
+
"eslint": "^9.23.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
@@ -1,39 +1,45 @@
|
|
|
1
|
-
/** @type {import("eslint").Linter.Config} */
|
|
2
|
-
export default {
|
|
3
|
-
rules: {
|
|
4
|
-
'array-callback-return': [
|
|
5
|
-
'error',
|
|
6
|
-
{
|
|
7
|
-
allowImplicit: true,
|
|
8
|
-
},
|
|
9
|
-
], // eslint-config-airbnb-base@15.0.0; best-practices
|
|
10
|
-
'no-await-in-loop': 'error', // eslint-config-airbnb-base@15.0.0; errors
|
|
11
|
-
'no-cond-assign': ['error', 'always'], // eslint-config-airbnb-base@15.0.0; errors
|
|
12
|
-
'no-console': 'warn', // eslint-config-airbnb-base@15.0.0; errors
|
|
13
|
-
'no-constructor-return': 'error', // eslint-config-airbnb-base@15.0.0; best-practices
|
|
14
|
-
'no-irregular-whitespace': [
|
|
15
|
-
'error',
|
|
16
|
-
{
|
|
17
|
-
skipComments: true,
|
|
18
|
-
skipRegExps: true,
|
|
19
|
-
skipTemplates: true,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
'no-promise-executor-return': 'error', // eslint-config-airbnb-base@15.0.0; errors
|
|
23
|
-
'no-self-compare': 'error', // eslint-config-airbnb-base@15.0.0; best-practices
|
|
24
|
-
'no-template-curly-in-string': 'error', // eslint-config-airbnb-base@15.0.0; errors
|
|
25
|
-
'no-unmodified-loop-condition': 'error',
|
|
26
|
-
'no-unsafe-optional-chaining': [
|
|
27
|
-
'error',
|
|
28
|
-
{
|
|
29
|
-
disallowArithmeticOperators: true,
|
|
30
|
-
},
|
|
31
|
-
], // eslint-config-airbnb-base@15.0.0; errors
|
|
32
|
-
'
|
|
33
|
-
'error',
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
/** @type {import("eslint").Linter.Config} */
|
|
2
|
+
export default {
|
|
3
|
+
rules: {
|
|
4
|
+
'array-callback-return': [
|
|
5
|
+
'error',
|
|
6
|
+
{
|
|
7
|
+
allowImplicit: true,
|
|
8
|
+
},
|
|
9
|
+
], // eslint-config-airbnb-base@15.0.0; best-practices
|
|
10
|
+
'no-await-in-loop': 'error', // eslint-config-airbnb-base@15.0.0; errors
|
|
11
|
+
'no-cond-assign': ['error', 'always'], // eslint-config-airbnb-base@15.0.0; errors
|
|
12
|
+
'no-console': 'warn', // eslint-config-airbnb-base@15.0.0; errors
|
|
13
|
+
'no-constructor-return': 'error', // eslint-config-airbnb-base@15.0.0; best-practices
|
|
14
|
+
'no-irregular-whitespace': [
|
|
15
|
+
'error',
|
|
16
|
+
{
|
|
17
|
+
skipComments: true,
|
|
18
|
+
skipRegExps: true,
|
|
19
|
+
skipTemplates: true,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
'no-promise-executor-return': 'error', // eslint-config-airbnb-base@15.0.0; errors
|
|
23
|
+
'no-self-compare': 'error', // eslint-config-airbnb-base@15.0.0; best-practices
|
|
24
|
+
'no-template-curly-in-string': 'error', // eslint-config-airbnb-base@15.0.0; errors
|
|
25
|
+
'no-unmodified-loop-condition': 'error',
|
|
26
|
+
'no-unsafe-optional-chaining': [
|
|
27
|
+
'error',
|
|
28
|
+
{
|
|
29
|
+
disallowArithmeticOperators: true,
|
|
30
|
+
},
|
|
31
|
+
], // eslint-config-airbnb-base@15.0.0; errors
|
|
32
|
+
'no-unused-vars': [
|
|
33
|
+
'error',
|
|
34
|
+
{
|
|
35
|
+
caughtErrors: 'none',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
'valid-typeof': [
|
|
39
|
+
'error',
|
|
40
|
+
{
|
|
41
|
+
requireStringLiterals: true,
|
|
42
|
+
},
|
|
43
|
+
], // eslint-config-airbnb-base@15.0.0; errors
|
|
44
|
+
},
|
|
45
|
+
};
|