@slashnephy/eslint-config 0.1.14 → 0.2.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/dist/index.js CHANGED
@@ -3,44 +3,58 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const path_1 = require("path");
4
4
  const config = {
5
5
  root: true,
6
+ extends: ['eslint:recommended'],
6
7
  overrides: [
7
8
  {
8
- files: '**/*.{js,jsx,ts,tsx}',
9
- extends: [
10
- (0, path_1.resolve)(__dirname, 'common.js'),
11
- (0, path_1.resolve)(__dirname, 'javascript.js'),
12
- ],
9
+ files: '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}',
10
+ extends: (0, path_1.resolve)(__dirname, 'javascript.js'),
13
11
  },
14
12
  {
15
- files: '**/*.{ts,tsx}',
13
+ files: '**/*.{ts,mts,cts,tsx}',
16
14
  extends: (0, path_1.resolve)(__dirname, 'typescript.js'),
17
15
  },
18
16
  {
19
- files: ['**/*.test.{js,ts}', '**/test/**/*.{js,ts}'],
17
+ files: [
18
+ '**/*.test.{js,mjs,cjs,jsx,ts,mts,cts,tsx}',
19
+ '**/test/**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}',
20
+ ],
20
21
  extends: (0, path_1.resolve)(__dirname, 'jest.js'),
21
22
  },
22
23
  {
23
- files: ['**/*.{j,t}sx'],
24
+ files: '**/*.{jsx,tsx}',
24
25
  extends: (0, path_1.resolve)(__dirname, 'react.js'),
25
26
  },
26
27
  {
27
- files: ['**/*.user.js'],
28
+ files: '**/*.json',
29
+ extends: (0, path_1.resolve)(__dirname, 'json.js'),
30
+ },
31
+ {
32
+ files: '**/*.{yml,yaml}',
33
+ extends: (0, path_1.resolve)(__dirname, 'yaml.js'),
34
+ },
35
+ {
36
+ files: '**/package.json',
37
+ extends: (0, path_1.resolve)(__dirname, 'package.json.js'),
38
+ },
39
+ {
40
+ files: '**/*.user.js',
28
41
  extends: (0, path_1.resolve)(__dirname, 'userscript.js'),
29
42
  },
30
43
  {
31
44
  files: [
32
45
  '**/webpack.config.{js,ts}',
33
46
  '**/rollup.config.{js,ts}',
34
- '**/pages/**/*.{js,jsx,ts,tsx}',
47
+ '**/pages/**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}',
35
48
  ],
36
49
  rules: {
37
50
  'import/no-default-export': 'off',
38
51
  },
39
52
  },
40
53
  {
41
- files: '**/*.{js,jsx,ts,tsx}',
54
+ files: '**/*',
42
55
  extends: (0, path_1.resolve)(__dirname, 'prettier.js'),
43
56
  },
44
57
  ],
58
+ ignorePatterns: ['**/node_modules/**'],
45
59
  };
46
60
  module.exports = config;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const javascript = {
4
4
  extends: [
5
+ 'plugin:eslint-comments/recommended',
5
6
  'plugin:node/recommended',
6
7
  'plugin:import/recommended',
7
8
  'plugin:xss/recommended',
@@ -16,9 +17,10 @@ const javascript = {
16
17
  ecmaVersion: 'latest',
17
18
  },
18
19
  rules: {
20
+ 'eslint-comments/no-unused-disable': 'error',
19
21
  'import/no-default-export': 'error',
20
22
  'prefer-arrow-callback': 'error',
21
- 'func-style': [2, 'declaration', { allowArrowFunctions: true }],
23
+ 'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
22
24
  curly: 'error',
23
25
  'prefer-template': 'error',
24
26
  eqeqeq: 'error',
@@ -64,6 +66,22 @@ const javascript = {
64
66
  'node/no-extraneous-import': 'off',
65
67
  'node/no-unpublished-import': 'off',
66
68
  'dot-notation': 'error',
69
+ 'object-shorthand': ['error', 'always'],
70
+ 'array-callback-return': ['error'],
71
+ 'no-await-in-loop': 'error',
72
+ 'no-constant-binary-expression': 'error',
73
+ 'no-constructor-return': 'error',
74
+ 'no-duplicate-imports': ['error', { includeExports: true }],
75
+ 'no-promise-executor-return': 'error',
76
+ 'no-self-compare': 'error',
77
+ 'no-template-curly-in-string': 'error',
78
+ 'no-unmodified-loop-condition': 'error',
79
+ 'no-unreachable-loop': 'error',
80
+ 'no-unused-private-class-members': 'error',
81
+ 'no-use-before-define': 'error',
82
+ 'require-atomic-updates': 'error',
83
+ 'func-call-spacing': ['error', 'never'],
84
+ 'accessor-pairs': 'error',
67
85
  },
68
86
  };
69
87
  module.exports = javascript;
package/dist/json.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const json = {
4
+ extends: ['plugin:json/recommended'],
5
+ };
6
+ module.exports = json;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const packageJson = {
4
+ extends: ['plugin:package-json/recommended'],
5
+ plugins: ['package-json'],
6
+ env: {
7
+ node: true,
8
+ },
9
+ rules: {
10
+ 'package-json/order-properties': [
11
+ 'error',
12
+ [
13
+ 'name',
14
+ 'version',
15
+ 'author',
16
+ 'description',
17
+ 'repository',
18
+ 'license',
19
+ 'private',
20
+ 'type',
21
+ 'main',
22
+ 'files',
23
+ 'publishConfig',
24
+ 'scripts',
25
+ 'dependencies',
26
+ 'peerDependencies',
27
+ 'optionalDependencies',
28
+ 'bundledDependencies',
29
+ 'devDependencies',
30
+ 'packageManager',
31
+ 'engines',
32
+ 'eslintConfig',
33
+ ],
34
+ ],
35
+ },
36
+ };
37
+ module.exports = packageJson;
package/dist/prettier.js CHANGED
@@ -11,5 +11,15 @@ const prettier = {
11
11
  'eol-last': ['error', 'always'],
12
12
  'no-trailing-spaces': ['error'],
13
13
  },
14
+ overrides: [
15
+ {
16
+ files: '**/*.json',
17
+ rules: {
18
+ quotes: ['error', 'double'],
19
+ semi: 'off',
20
+ 'eol-last': 'off',
21
+ },
22
+ },
23
+ ],
14
24
  };
15
25
  module.exports = prettier;
package/dist/react.js CHANGED
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const react = {
4
4
  extends: [
5
5
  'next/core-web-vitals',
6
+ 'plugin:react/recommended',
7
+ 'plugin:react/jsx-runtime',
6
8
  'plugin:css-import-order/recommended',
7
9
  ],
8
10
  plugins: ['css-import-order'],
@@ -4,6 +4,7 @@ const typescript = {
4
4
  extends: [
5
5
  'plugin:@typescript-eslint/recommended',
6
6
  'plugin:@typescript-eslint/recommended-requiring-type-checking',
7
+ 'plugin:@typescript-eslint/strict',
7
8
  'plugin:import/typescript',
8
9
  ],
9
10
  plugins: ['@typescript-eslint'],
@@ -16,39 +17,117 @@ const typescript = {
16
17
  warnOnUnsupportedTypeScriptVersion: true,
17
18
  },
18
19
  rules: {
19
- '@typescript-eslint/no-unused-vars': 'off',
20
- 'unused-imports/no-unused-vars': [
20
+ '@typescript-eslint/consistent-type-exports': [
21
+ 'error',
22
+ {
23
+ fixMixedExportsWithInlineTypeSpecifier: true,
24
+ },
25
+ ],
26
+ '@typescript-eslint/consistent-type-imports': 'error',
27
+ '@typescript-eslint/explicit-function-return-type': 'warn',
28
+ '@typescript-eslint/explicit-member-accessibility': 'error',
29
+ '@typescript-eslint/explicit-module-boundary-types': 'warn',
30
+ '@typescript-eslint/member-delimiter-style': 'error',
31
+ '@typescript-eslint/member-ordering': 'warn',
32
+ '@typescript-eslint/method-signature-style': 'warn',
33
+ '@typescript-eslint/naming-convention': [
21
34
  'warn',
22
35
  {
23
- vars: 'all',
24
- varsIgnorePattern: '^_',
25
- args: 'after-used',
26
- argsIgnorePattern: '^_',
36
+ selector: ['default'],
37
+ format: ['camelCase'],
38
+ },
39
+ {
40
+ selector: ['variableLike'],
41
+ format: ['camelCase'],
42
+ leadingUnderscore: 'allow',
43
+ },
44
+ {
45
+ selector: ['variable'],
46
+ modifiers: ['const', 'global', 'exported'],
47
+ format: ['UPPER_CASE'],
48
+ },
49
+ {
50
+ selector: ['variableLike'],
51
+ types: ['boolean'],
52
+ format: ['PascalCase'],
53
+ prefix: ['is', 'should', 'has', 'can', 'did', 'will', 'contains'],
54
+ },
55
+ {
56
+ selector: ['typeLike'],
57
+ format: ['PascalCase'],
58
+ },
59
+ {
60
+ selector: ['memberLike'],
61
+ modifiers: ['private'],
62
+ format: ['camelCase'],
63
+ leadingUnderscore: 'require',
64
+ },
65
+ {
66
+ selector: ['memberLike'],
67
+ modifiers: ['requiresQuotes'],
68
+ format: null,
69
+ },
70
+ {
71
+ selector: ['variableLike'],
72
+ modifiers: ['destructured'],
73
+ format: null,
27
74
  },
28
75
  ],
29
- '@typescript-eslint/consistent-type-imports': [
30
- 'error',
76
+ '@typescript-eslint/no-confusing-void-expression': 'error',
77
+ '@typescript-eslint/no-implicit-any-catch': 'error',
78
+ '@typescript-eslint/no-redundant-type-constituents': 'warn',
79
+ '@typescript-eslint/no-require-imports': 'warn',
80
+ '@typescript-eslint/no-type-alias': 'warn',
81
+ '@typescript-eslint/no-unnecessary-qualifier': 'error',
82
+ '@typescript-eslint/no-useless-empty-export': 'error',
83
+ '@typescript-eslint/parameter-properties': [
84
+ 'warn',
31
85
  {
32
- prefer: 'type-imports',
86
+ allow: [
87
+ 'readonly',
88
+ 'private',
89
+ 'protected',
90
+ 'public',
91
+ 'private readonly',
92
+ 'protected readonly',
93
+ 'public readonly',
94
+ ],
95
+ prefer: 'parameter-property',
33
96
  },
34
97
  ],
35
- '@typescript-eslint/array-type': 'error',
36
- '@typescript-eslint/consistent-type-assertions': 'error',
37
- '@typescript-eslint/no-floating-promises': 'warn',
38
- '@typescript-eslint/no-require-imports': 'error',
98
+ '@typescript-eslint/prefer-enum-initializers': 'warn',
99
+ '@typescript-eslint/prefer-readonly': 'error',
100
+ '@typescript-eslint/prefer-readonly-parameter-types': 'warn',
101
+ '@typescript-eslint/prefer-regexp-exec': 'error',
39
102
  '@typescript-eslint/promise-function-async': 'error',
40
- '@typescript-eslint/no-implied-eval': 'error',
41
- 'react/react-in-jsx-scope': 'off',
42
- '@typescript-eslint/restrict-template-expressions': 'off',
43
- '@typescript-eslint/unbound-method': 'off',
44
- '@typescript-eslint/no-unsafe-assignment': 'off',
103
+ '@typescript-eslint/require-array-sort-compare': 'off',
104
+ '@typescript-eslint/sort-type-union-intersection-members': 'error',
105
+ '@typescript-eslint/strict-boolean-expressions': 'error',
106
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
107
+ '@typescript-eslint/type-annotation-spacing': 'error',
108
+ '@typescript-eslint/restrict-template-expressions': [
109
+ 'error',
110
+ {
111
+ allowNumber: true,
112
+ allowBoolean: true,
113
+ allowNullish: true,
114
+ },
115
+ ],
45
116
  '@typescript-eslint/no-unsafe-argument': 'off',
46
- '@typescript-eslint/no-unsafe-member-access': 'off',
117
+ '@typescript-eslint/no-unsafe-assignment': 'off',
47
118
  '@typescript-eslint/no-unsafe-call': 'off',
119
+ '@typescript-eslint/no-unsafe-member-access': 'off',
48
120
  '@typescript-eslint/no-unsafe-return': 'off',
49
- '@typescript-eslint/no-misused-promises': 'off',
50
- '@typescript-eslint/explicit-member-accessibility': 'error',
51
- '@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
121
+ '@typescript-eslint/no-unused-vars': 'off',
122
+ 'unused-imports/no-unused-vars': [
123
+ 'warn',
124
+ {
125
+ vars: 'all',
126
+ varsIgnorePattern: '^_',
127
+ args: 'after-used',
128
+ argsIgnorePattern: '^_',
129
+ },
130
+ ],
52
131
  },
53
132
  };
54
133
  module.exports = typescript;
package/dist/yaml.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const yaml = {
4
+ extends: ['plugin:yml/standard', 'plugin:yml/prettier'],
5
+ parser: 'yaml-eslint-parser',
6
+ rules: {
7
+ 'yml/quotes': ['error', { prefer: 'double' }],
8
+ },
9
+ };
10
+ module.exports = yaml;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@slashnephy/eslint-config",
3
- "version": "0.1.14",
3
+ "version": "0.2.0",
4
+ "author": "SlashNephy <spica@starry.blue> (https://spica.starry.blue/)",
4
5
  "repository": {
6
+ "type": "git",
5
7
  "url": "https://github.com/SlashNephy/.github",
6
8
  "directory": "env/eslint"
7
9
  },
8
- "author": "SlashNephy <spica@starry.blue> (https://spica.starry.blue/)",
9
10
  "license": "MIT",
10
11
  "main": "dist/index.js",
11
12
  "files": [
@@ -17,18 +18,18 @@
17
18
  },
18
19
  "scripts": {
19
20
  "build": "tsc",
20
- "lint": "concurrently -n lint: 'yarn:lint:*'",
21
- "lint:eslint": "eslint .",
22
- "lint:prettier": "prettier --check .",
21
+ "clean": "rm -rf dist/*",
23
22
  "format": "concurrently -n format: 'yarn:format:*'",
24
- "format:eslint": "yarn lint:eslint --fix",
23
+ "format:eslint": "yarn build && yarn lint:eslint --fix",
25
24
  "format:prettier": "yarn lint:prettier --write",
26
- "clean": "rm -rf dist/*",
25
+ "lint": "concurrently -n lint: 'yarn:lint:*'",
26
+ "lint:eslint": "yarn build && eslint .",
27
+ "lint:prettier": "prettier --check .",
27
28
  "publish": "yarn clean && yarn build && yarn npm publish"
28
29
  },
29
30
  "dependencies": {
30
31
  "@typescript-eslint/eslint-plugin": "5.36.1",
31
- "@typescript-eslint/parser": "5.33.0",
32
+ "@typescript-eslint/parser": "5.36.1",
32
33
  "eslint-config-next": "12.2.5",
33
34
  "eslint-config-prettier": "8.5.0",
34
35
  "eslint-import-resolver-typescript": "3.5.0",
@@ -36,15 +37,18 @@
36
37
  "eslint-plugin-editorconfig": "4.0.2",
37
38
  "eslint-plugin-eslint-comments": "3.2.0",
38
39
  "eslint-plugin-import": "2.26.0",
39
- "eslint-plugin-jest": "26.8.2",
40
+ "eslint-plugin-jest": "27.0.1",
40
41
  "eslint-plugin-jest-formatting": "3.1.0",
42
+ "eslint-plugin-json": "3.1.0",
41
43
  "eslint-plugin-node": "11.1.0",
44
+ "eslint-plugin-package-json": "0.1.4",
42
45
  "eslint-plugin-promise": "6.0.1",
43
- "eslint-plugin-react": "7.30.1",
46
+ "eslint-plugin-react": "7.31.5",
44
47
  "eslint-plugin-react-hooks": "4.6.0",
45
48
  "eslint-plugin-unused-imports": "2.0.0",
46
49
  "eslint-plugin-userscripts": "0.2.9",
47
- "eslint-plugin-xss": "0.1.12"
50
+ "eslint-plugin-xss": "0.1.12",
51
+ "eslint-plugin-yml": "1.2.0"
48
52
  },
49
53
  "peerDependencies": {
50
54
  "eslint": "^8",
@@ -56,12 +60,12 @@
56
60
  "@types/eslint": "8.4.6",
57
61
  "@types/node": "17.0.41",
58
62
  "@types/prettier": "2.7.0",
59
- "concurrently": "7.3.0",
63
+ "concurrently": "7.4.0",
60
64
  "eslint": "8.22.0",
61
65
  "prettier": "2.7.1",
62
- "typescript": "4.8.2"
66
+ "typescript": "4.8.3"
63
67
  },
64
- "packageManager": "yarn@3.2.2",
68
+ "packageManager": "yarn@3.2.3",
65
69
  "eslintConfig": {
66
70
  "extends": [
67
71
  "./dist/index.js"
package/dist/common.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const common = {
4
- extends: ['eslint:recommended', 'plugin:eslint-comments/recommended'],
5
- rules: {
6
- 'eslint-comments/no-unused-disable': 'error',
7
- },
8
- };
9
- module.exports = common;