@willbooster/eslint-config-js 10.3.1 → 11.0.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
@@ -1,17 +1,17 @@
1
1
  # eslint-config-js
2
2
 
3
- A ESLint config for JavaScript projects.
3
+ A ESLint flat config for JavaScript projects.
4
4
  You need to do the following command to install peer dependencies.
5
5
 
6
6
  ```sh
7
7
  yarn add -D @willbooster/eslint-config-js \
8
8
  eslint \
9
9
  eslint-config-prettier \
10
- eslint-plugin-import \
10
+ eslint-plugin-import-x \
11
11
  eslint-plugin-prettier \
12
12
  eslint-plugin-sort-class-members \
13
13
  eslint-plugin-sort-destructure-keys \
14
14
  eslint-plugin-unicorn \
15
- prettier \
16
- @willbooster/prettier-config
15
+ eslint-plugin-unused-imports \
16
+ globals
17
17
  ```
@@ -0,0 +1,121 @@
1
+ import js from '@eslint/js';
2
+ import eslintConfigPrettier from 'eslint-config-prettier';
3
+ import eslintPluginImportX from 'eslint-plugin-import-x';
4
+ import eslintPluginSortClassMembers from 'eslint-plugin-sort-class-members';
5
+ import eslintPluginSortDestructureKeys from 'eslint-plugin-sort-destructure-keys';
6
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn';
7
+ import eslintPluginUnusedImports from 'eslint-plugin-unused-imports';
8
+ import globals from 'globals';
9
+
10
+ export default [
11
+ // Note: don't merge the below two objects!
12
+ {
13
+ files: ['{,src/**/,tests/**/,scripts/**/}*.{cjs,js,mjs}'],
14
+ },
15
+ {
16
+ ignores: [
17
+ // Directories
18
+ '.yarn/**',
19
+ '3rd-party/**',
20
+ '@types/**',
21
+ '__generated__/**',
22
+ 'android/**',
23
+ 'build/**',
24
+ 'coverage/**',
25
+ 'dist/**',
26
+ 'ios/**',
27
+ 'no-format/**',
28
+ 'node_modules/**',
29
+ 'temp/**',
30
+ 'test-fixtures/**',
31
+ // Files
32
+ '*.d.ts',
33
+ '*.min.*js',
34
+ ],
35
+ },
36
+ // cf. https://github.com/eslint/eslint/blob/main/packages/js/src/configs/eslint-recommended.js
37
+ js.configs.recommended,
38
+ // cf. https://github.com/un-ts/eslint-plugin-import-x#configuration-new-eslintconfigjs
39
+ eslintPluginImportX.flatConfigs.recommended,
40
+ // cf. https://github.com/sindresorhus/eslint-plugin-unicorn#recommended-config
41
+ eslintPluginUnicorn.configs.recommended,
42
+ {
43
+ plugins: {
44
+ 'sort-class-members': eslintPluginSortClassMembers,
45
+ 'sort-destructure-keys': eslintPluginSortDestructureKeys,
46
+ },
47
+ languageOptions: {
48
+ ecmaVersion: 'latest',
49
+ globals: {
50
+ // for Web
51
+ ...globals.browser,
52
+ ...globals.serviceworker,
53
+ // for Node.js
54
+ ...globals.node,
55
+ },
56
+ },
57
+ rules: {
58
+ eqeqeq: 'warn',
59
+ 'no-console': 'off', // Allow `console.log()`.
60
+ 'no-unused-vars': ['warn', { ignoreRestSiblings: true }], // Allow unused vars in object destructuring.
61
+ 'object-shorthand': 'error',
62
+ 'one-var': ['error', 'never'], // We prefer one variable declaration per line.
63
+ 'spaced-comment': 'error', // Enforce consistency of spacing after the start of a comment // or /*.
64
+ 'import-x/newline-after-import': 'error',
65
+ 'import-x/no-duplicates': 'error',
66
+ 'import-x/order': [
67
+ 'error',
68
+ {
69
+ 'newlines-between': 'always',
70
+ alphabetize: {
71
+ order: 'asc',
72
+ },
73
+ },
74
+ ],
75
+ 'sort-destructure-keys/sort-destructure-keys': 'error',
76
+ 'unicorn/filename-case': [
77
+ 'error',
78
+ {
79
+ cases: {
80
+ camelCase: true,
81
+ pascalCase: true,
82
+ },
83
+ },
84
+ ],
85
+ 'unicorn/no-abusive-eslint-disable': 'off',
86
+ 'unicorn/no-array-callback-reference': 'off',
87
+ 'unicorn/no-array-reduce': 'warn',
88
+ 'unicorn/no-null': 'warn',
89
+ 'unicorn/no-process-exit': 'off',
90
+ 'unicorn/no-useless-undefined': [
91
+ 'error',
92
+ {
93
+ checkArguments: false,
94
+ },
95
+ ],
96
+ 'unicorn/prefer-top-level-await': 'warn',
97
+ 'unicorn/prevent-abbreviations': 'off',
98
+ },
99
+ },
100
+ // cf. https://github.com/sweepline/eslint-plugin-unused-imports#usage
101
+ {
102
+ plugins: {
103
+ 'unused-imports': eslintPluginUnusedImports,
104
+ },
105
+ rules: {
106
+ 'no-unused-vars': 'off',
107
+ 'unused-imports/no-unused-imports': 'error',
108
+ 'unused-imports/no-unused-vars': [
109
+ 'warn',
110
+ {
111
+ vars: 'all',
112
+ varsIgnorePattern: '^_',
113
+ args: 'after-used',
114
+ argsIgnorePattern: '^_',
115
+ },
116
+ ],
117
+ },
118
+ },
119
+ // cf. https://github.com/prettier/eslint-config-prettier#installation
120
+ eslintConfigPrettier,
121
+ ];
package/package.json CHANGED
@@ -1,44 +1,49 @@
1
1
  {
2
2
  "name": "@willbooster/eslint-config-js",
3
- "version": "10.3.1",
4
- "description": "A ESLint config for JavaScript projects",
3
+ "version": "11.0.0",
4
+ "description": "A ESLint flat config for JavaScript projects",
5
5
  "license": "Apache-2.0",
6
6
  "author": "WillBooster Inc.",
7
- "main": ".eslintrc.json",
7
+ "type": "module",
8
+ "main": "eslint.config.js",
8
9
  "files": [
9
- ".eslintrc.json"
10
+ "eslint.config.js"
10
11
  ],
11
12
  "scripts": {
12
13
  "cleanup": "yarn format && yarn lint-fix",
13
14
  "format": "sort-package-json && yarn prettify",
14
- "lint": "eslint --color \"./{scripts,src,tests}/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}\"",
15
+ "lint": "eslint --color",
15
16
  "lint-fix": "yarn lint --fix",
16
17
  "prettify": "prettier --cache --color --write \"**/{.*/,}*.{cjs,css,cts,htm,html,js,json,json5,jsonc,jsx,md,mjs,mts,scss,ts,tsx,vue,yaml,yml}\" \"!**/test-fixtures/**\"",
17
18
  "test": "yarn lint"
18
19
  },
19
20
  "prettier": "@willbooster/prettier-config",
20
21
  "devDependencies": {
21
- "@types/eslint": "8.56.11",
22
- "@types/micromatch": "4.0.9",
23
- "@willbooster/prettier-config": "9.1.3",
24
- "eslint": "8.57.0",
25
- "eslint-config-prettier": "9.1.0",
26
- "eslint-plugin-import": "2.31.0",
27
- "eslint-plugin-sort-class-members": "1.20.0",
22
+ "@eslint/js": "9.21.0",
23
+ "@willbooster/prettier-config": "10.0.0",
24
+ "eslint": "9.21.0",
25
+ "eslint-config-prettier": "10.0.2",
26
+ "eslint-plugin-import-x": "4.6.1",
27
+ "eslint-plugin-sort-class-members": "1.21.0",
28
28
  "eslint-plugin-sort-destructure-keys": "2.0.0",
29
- "eslint-plugin-unicorn": "56.0.0",
30
- "lint-staged": "15.2.10",
29
+ "eslint-plugin-unicorn": "57.0.0",
30
+ "eslint-plugin-unused-imports": "4.1.4",
31
+ "globals": "16.0.0",
32
+ "lint-staged": "15.4.3",
31
33
  "micromatch": "4.0.8",
32
- "prettier": "3.3.3",
33
- "sort-package-json": "2.10.1"
34
+ "prettier": "3.5.3",
35
+ "sort-package-json": "3.0.0"
34
36
  },
35
37
  "peerDependencies": {
36
- "@willbooster/prettier-config": "9.1.3",
37
- "eslint": ">=8",
38
- "eslint-config-prettier": ">=8",
39
- "eslint-plugin-import": ">=2",
40
- "eslint-plugin-sort-class-members": ">=1.14",
41
- "eslint-plugin-sort-destructure-keys": ">=1.4"
38
+ "@eslint/js": ">=9",
39
+ "eslint": ">=9",
40
+ "eslint-config-prettier": ">=10",
41
+ "eslint-plugin-import-x": ">=4",
42
+ "eslint-plugin-sort-class-members": ">=1.21",
43
+ "eslint-plugin-sort-destructure-keys": ">=2",
44
+ "eslint-plugin-unicorn": ">=57",
45
+ "eslint-plugin-unused-imports": ">=4",
46
+ "globals": ">=16"
42
47
  },
43
48
  "publishConfig": {
44
49
  "access": "public"
package/.eslintrc.json DELETED
@@ -1,56 +0,0 @@
1
- {
2
- "extends": [
3
- "eslint:recommended",
4
- "plugin:import/recommended",
5
- "plugin:sort-class-members/recommended",
6
- "plugin:unicorn/recommended",
7
- "prettier"
8
- ],
9
- "plugins": ["sort-destructure-keys"],
10
- "parserOptions": {
11
- "ecmaVersion": "latest"
12
- },
13
- "env": { "es2022": true },
14
- "rules": {
15
- "eqeqeq": "warn",
16
- "no-console": "off", // Allow `console.log()`.
17
- "no-unused-vars": ["warn", { "ignoreRestSiblings": true }], // Allow unused vars in object destructuring.
18
- "object-shorthand": "error",
19
- "one-var": ["error", "never"], // We prefer one variable declaration per line.
20
- "spaced-comment": "error", // Enforce consistency of spacing after the start of a comment // or /*.
21
- "import/newline-after-import": "error",
22
- "import/no-duplicates": "error",
23
- "import/order": [
24
- "error",
25
- {
26
- "newlines-between": "always",
27
- "alphabetize": {
28
- "order": "asc"
29
- }
30
- }
31
- ],
32
- "sort-destructure-keys/sort-destructure-keys": "error",
33
- "unicorn/filename-case": [
34
- "error",
35
- {
36
- "cases": {
37
- "camelCase": true,
38
- "pascalCase": true
39
- }
40
- }
41
- ],
42
- "unicorn/no-abusive-eslint-disable": "off",
43
- "unicorn/no-array-callback-reference": "off",
44
- "unicorn/no-array-reduce": "warn",
45
- "unicorn/no-null": "warn",
46
- "unicorn/no-process-exit": "off",
47
- "unicorn/no-useless-undefined": [
48
- "error",
49
- {
50
- "checkArguments": false
51
- }
52
- ],
53
- "unicorn/prefer-top-level-await": "warn",
54
- "unicorn/prevent-abbreviations": "off"
55
- }
56
- }