@pumpn/eslint-config 10.4.2 → 11.0.2

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/config.js ADDED
@@ -0,0 +1,111 @@
1
+ import babelParser from "@babel/eslint-parser";
2
+ import js from "@eslint/js";
3
+ import eslintPluginImport from "eslint-plugin-import";
4
+ import eslintPluginJsdoc from "eslint-plugin-jsdoc";
5
+ import reactJsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js";
6
+ import reactRecommended from "eslint-plugin-react/configs/recommended.js";
7
+ import eslintPluginSortKeysPlus from "eslint-plugin-sort-keys-plus";
8
+ import globals from "globals";
9
+
10
+ import rules from "./rules.js";
11
+
12
+ const convertedGlobals = Object.fromEntries(
13
+ Object.entries({
14
+ ...globals.node,
15
+ ...globals.browser
16
+ })
17
+ .map(([global, isWritable]) => [global, isWritable ? "writable" : "readonly"])
18
+ );
19
+
20
+ export default [
21
+ js.configs.recommended,
22
+ {
23
+ files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
24
+ ...reactRecommended,
25
+ ...reactJsxRuntime
26
+ },
27
+ {
28
+ files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
29
+ languageOptions: {
30
+ ecmaVersion: "latest",
31
+ sourceType: "module",
32
+ globals: {
33
+ ...convertedGlobals
34
+ },
35
+ parser: babelParser,
36
+ parserOptions: {
37
+ ecmaVersion: "latest",
38
+ sourceType: "module",
39
+ requireConfigFile: false,
40
+ ecmaFeatures: {
41
+ jsx: true
42
+ },
43
+ babelOptions: {
44
+ babelrc: false,
45
+ configFile: false,
46
+ presets: ["@babel/preset-react"],
47
+ plugins: ["@babel/plugin-syntax-import-assertions", "@babel/plugin-proposal-export-default-from"]
48
+ }
49
+ }
50
+ },
51
+ plugins: {
52
+ "sort-keys-plus": eslintPluginSortKeysPlus,
53
+ jsdoc: eslintPluginJsdoc,
54
+ import: eslintPluginImport
55
+ },
56
+ settings: {
57
+ jsdoc: {
58
+ ignorePrivate: true,
59
+ mode: "permissive"
60
+ },
61
+ "import/core-modules": [],
62
+ "import/extensions": [
63
+ ".js",
64
+ ".mjs",
65
+ ".jsx"
66
+ ],
67
+ "import/ignore": ["node_modules", "\\.(coffee|scss|css|less|hbs|svg|json|cjs)$"],
68
+ "import/parsers": {
69
+ espree: [
70
+ ".js",
71
+ ".cjs",
72
+ ".mjs",
73
+ ".jsx"
74
+ ]
75
+ },
76
+ "import/resolver": {
77
+ node: true
78
+ },
79
+ react: {
80
+ version: "detect"
81
+ },
82
+ formComponents: ["Form"],
83
+ linkComponents: [
84
+ {
85
+ name: "Link",
86
+ linkAttribute: "to"
87
+ }
88
+ ]
89
+ },
90
+ rules
91
+ },
92
+ {
93
+ files: ["jsdoc-example.js"],
94
+ rules: {
95
+ "import/no-unused-modules": "off"
96
+ }
97
+ },
98
+ {
99
+ files: ["**/**.cjs"],
100
+ rules: {
101
+ "import/no-commonjs": ["off"],
102
+ "import/no-unused-modules": "off"
103
+ }
104
+ },
105
+ {
106
+ languageOptions: {
107
+ ecmaVersion: "latest",
108
+ sourceType: "module"
109
+ }
110
+ }
111
+ ];
package/package.json CHANGED
@@ -1,32 +1,38 @@
1
1
  {
2
2
  "name": "@pumpn/eslint-config",
3
- "version": "10.4.2",
3
+ "version": "11.0.2",
4
4
  "description": "standard eslint config for pumpn code projects",
5
- "main": "index.cjs",
5
+ "main": "config.js",
6
6
  "author": "Nano Miratus <nanomiratus@gmail.com>",
7
7
  "license": "MIT",
8
8
  "private": false,
9
9
  "type": "module",
10
- "peerDependencies": {
11
- "eslint": "^7.32.0"
12
- },
13
- "dependencies": {
14
- "@babel/eslint-parser": "^7.15.4",
15
- "confusing-browser-globals": "^1.0.10",
16
- "eslint-plugin-compat": "^3.13.0",
17
- "eslint-plugin-import": "^2.24.2",
18
- "eslint-plugin-jsdoc": "^36.1.0",
19
- "eslint-plugin-sort-keys": "^2.3.5"
20
- },
21
10
  "repository": "https://github.com/pumpncode/eslint-config",
22
- "devDependencies": {
23
- "@babel/core": "^7.15.5",
24
- "@pumpn/babel-preset": "^3.2.2",
25
- "@pumpn/np-config": "^2.3.2",
26
- "eslint": "^7.32.0"
27
- },
28
11
  "scripts": {
12
+ "lint": "eslint .",
13
+ "prepublish": "npm run lint",
29
14
  "release": "np",
30
15
  "test": "echo 'no tests yet'"
16
+ },
17
+ "devDependencies": {
18
+ "@pumpn/np-config": "^2.3.2",
19
+ "eslint": "^8.35.0",
20
+ "eslint-plugin-react": "*",
21
+ "np": "^7.6.3"
22
+ },
23
+ "dependencies": {
24
+ "@babel/eslint-parser": "^7.19.1",
25
+ "@babel/plugin-proposal-export-default-from": "^7.18.10",
26
+ "@babel/plugin-syntax-import-assertions": "^7.20.0",
27
+ "@babel/preset-react": "^7.18.6",
28
+ "@eslint/js": "^8.35.0",
29
+ "globals": "^13.20.0"
30
+ },
31
+ "peerDependencies": {
32
+ "eslint": "^8.34.0",
33
+ "eslint-plugin-import": "^2.27.5",
34
+ "eslint-plugin-jsdoc": "^40.0.0",
35
+ "eslint-plugin-react": "^7.32.2",
36
+ "eslint-plugin-sort-keys-plus": "^1.3.1"
31
37
  }
32
38
  }
@@ -0,0 +1,134 @@
1
+ const maxDependencies = 10;
2
+
3
+ export default {
4
+ "import/default": ["error"],
5
+ "import/dynamic-import-chunkname": [
6
+ "off",
7
+ {
8
+ importFunctions: [],
9
+ webpackChunknameFormat: "[0-9a-zA-Z-_/.]+"
10
+ }
11
+ ],
12
+ "import/export": ["error"],
13
+ "import/exports-last": ["error"],
14
+ "import/extensions": ["error", "ignorePackages"],
15
+ "import/first": ["error"],
16
+ "import/group-exports": ["off"],
17
+ "import/max-dependencies": [
18
+ "error",
19
+ {
20
+ max: maxDependencies
21
+ }
22
+ ],
23
+ "import/named": ["error"],
24
+ "import/namespace": ["error"],
25
+ "import/newline-after-import": ["error"],
26
+ "import/no-absolute-path": ["error"],
27
+ "import/no-amd": ["error"],
28
+ "import/no-anonymous-default-export": [
29
+ "off",
30
+ {
31
+ allowAnonymousClass: false,
32
+ allowAnonymousFunction: false,
33
+ allowArray: false,
34
+ allowArrowFunction: false,
35
+ allowLiteral: false,
36
+ allowObject: false
37
+ }
38
+ ],
39
+ "import/no-commonjs": ["error"],
40
+ "import/no-cycle": [
41
+ "error",
42
+ {
43
+ maxDepth: Infinity
44
+ }
45
+ ],
46
+ "import/no-default-export": ["off"],
47
+ "import/no-deprecated": ["error"],
48
+ "import/no-duplicates": ["error"],
49
+ "import/no-dynamic-require": ["error"],
50
+ "import/no-extraneous-dependencies": [
51
+ "error",
52
+ {
53
+ devDependencies: [
54
+ "test/**",
55
+ "tests/**",
56
+ "spec/**",
57
+ "**/__tests__/**",
58
+ "**/__mocks__/**",
59
+ "test.{js,jsx}",
60
+ "test-*.{js,jsx}",
61
+ "**/*{.,_}{test,spec}.{js,jsx}",
62
+ "**/jest.config.js",
63
+ "**/jest.setup.js",
64
+ "**/vue.config.js",
65
+ "**/webpack.config.js",
66
+ "**/webpack.config.*.js",
67
+ "**/rollup.config.js",
68
+ "**/rollup.config.*.js",
69
+ "**/gulpfile.js",
70
+ "**/gulpfile.*.js",
71
+ "**/Gruntfile{,.js}",
72
+ "**/protractor.conf.js",
73
+ "**/protractor.conf.*.js",
74
+ "**/karma.conf.js",
75
+ "**/eslint.config.js"
76
+ ],
77
+ optionalDependencies: false
78
+ }
79
+ ],
80
+ "import/no-internal-modules": [
81
+ "off",
82
+ {
83
+ allow: []
84
+ }
85
+ ],
86
+ "import/no-mutable-exports": ["error"],
87
+ "import/no-named-as-default": ["error"],
88
+ "import/no-named-as-default-member": ["error"],
89
+ "import/no-named-default": ["error"],
90
+ "import/no-named-export": ["off"],
91
+ "import/no-namespace": ["error"],
92
+ "import/no-nodejs-modules": ["off"],
93
+ "import/no-relative-parent-imports": ["off"],
94
+ "import/no-restricted-paths": ["off"],
95
+ "import/no-self-import": ["error"],
96
+ "import/no-unassigned-import": ["error"],
97
+ "import/no-unresolved": [
98
+ "error",
99
+ {
100
+ caseSensitive: true,
101
+ commonjs: true
102
+ }
103
+ ],
104
+ "import/no-unused-modules": [
105
+ "off",
106
+ {
107
+ ignoreExports: ["./main.js"],
108
+ missingExports: true,
109
+ unusedExports: false
110
+ }
111
+ ],
112
+ "import/no-useless-path-segments": [
113
+ "error",
114
+ {
115
+ commonjs: true
116
+ }
117
+ ],
118
+ "import/no-webpack-loader-syntax": ["error"],
119
+ "import/order": [
120
+ "error",
121
+ {
122
+ groups: [
123
+ "builtin",
124
+ "external",
125
+ "parent",
126
+ "sibling",
127
+ "index"
128
+ ],
129
+ "newlines-between": "always"
130
+ }
131
+ ],
132
+ "import/prefer-default-export": ["error"],
133
+ "import/unambiguous": "off"
134
+ };
package/rules/jsdoc.js ADDED
@@ -0,0 +1,79 @@
1
+ export default {
2
+ "jsdoc/check-access": ["warn"],
3
+ "jsdoc/check-alignment": ["warn", "always"],
4
+ "jsdoc/check-examples": [
5
+ "off",
6
+ {
7
+ matchingFileName: "jsdoc-example.js"
8
+ }
9
+ ],
10
+ "jsdoc/check-indentation": [
11
+ "warn",
12
+ {
13
+ excludeTags: ["description", "example"]
14
+ }
15
+ ],
16
+ "jsdoc/check-param-names": ["warn"],
17
+ "jsdoc/check-property-names": ["warn"],
18
+ "jsdoc/check-syntax": ["warn"],
19
+ "jsdoc/check-tag-names": ["warn"],
20
+ "jsdoc/check-types": ["warn"],
21
+ "jsdoc/check-values": ["warn"],
22
+ "jsdoc/empty-tags": ["warn"],
23
+ "jsdoc/implements-on-classes": ["warn"],
24
+ "jsdoc/match-description": ["warn"],
25
+ "jsdoc/newline-after-description": ["warn"],
26
+ "jsdoc/no-bad-blocks": ["warn"],
27
+ "jsdoc/no-defaults": ["warn"],
28
+ "jsdoc/no-undefined-types": ["warn"],
29
+ "jsdoc/require-description": [
30
+ "warn",
31
+ {
32
+ contexts: [
33
+ "Program",
34
+ "ArrowFunctionExpression",
35
+ "FunctionDeclaration",
36
+ "FunctionExpression",
37
+ "VariableDeclaration"
38
+ ]
39
+ }
40
+ ],
41
+ "jsdoc/require-description-complete-sentence": ["warn"],
42
+ "jsdoc/require-example": ["off"],
43
+ "jsdoc/require-file-overview": ["off"],
44
+ "jsdoc/require-hyphen-before-param-description": ["warn"],
45
+ "jsdoc/require-jsdoc": [
46
+ "warn",
47
+ {
48
+ contexts: [
49
+ "ArrowFunctionExpression",
50
+ "ClassDeclaration",
51
+ "ClassExpression",
52
+ "FunctionDeclaration",
53
+ "FunctionExpression"
54
+ ],
55
+ publicOnly: true,
56
+ require: {
57
+ ArrowFunctionExpression: true,
58
+ ClassDeclaration: true,
59
+ ClassExpression: true,
60
+ FunctionDeclaration: true,
61
+ FunctionExpression: true,
62
+ MethodDefinition: true
63
+ }
64
+ }
65
+ ],
66
+ "jsdoc/require-param": ["warn"],
67
+ "jsdoc/require-param-description": ["warn"],
68
+ "jsdoc/require-param-name": ["warn"],
69
+ "jsdoc/require-param-type": ["warn"],
70
+ "jsdoc/require-property": ["warn"],
71
+ "jsdoc/require-property-description": ["warn"],
72
+ "jsdoc/require-property-name": ["warn"],
73
+ "jsdoc/require-property-type": ["warn"],
74
+ "jsdoc/require-returns": ["warn"],
75
+ "jsdoc/require-returns-check": ["warn"],
76
+ "jsdoc/require-returns-description": ["warn"],
77
+ "jsdoc/require-returns-type": ["warn"],
78
+ "jsdoc/valid-types": ["warn"]
79
+ };
@@ -0,0 +1,262 @@
1
+ const minItemsForArrayNewline = 3;
2
+ const maxLineLength = 100;
3
+ const tabWidth = 4;
4
+ const maxIgnoredChainDepth = 3;
5
+ const minPropertiesForObjectNewline = 3;
6
+
7
+ export default {
8
+ "array-bracket-newline": [
9
+ "error",
10
+ {
11
+ multiline: true,
12
+ minItems: minItemsForArrayNewline
13
+ }
14
+ ],
15
+ "array-bracket-spacing": ["error", "never"],
16
+ "array-element-newline": [
17
+ "error",
18
+ {
19
+ multiline: true,
20
+ minItems: minItemsForArrayNewline
21
+ }
22
+ ],
23
+ "arrow-parens": ["error", "always"],
24
+ "arrow-spacing": [
25
+ "error",
26
+ {
27
+ before: true,
28
+ after: true
29
+ }
30
+ ],
31
+ "block-spacing": ["error", "always"],
32
+ "brace-style": ["error", "stroustrup"],
33
+ "comma-dangle": ["error", "never"],
34
+ "comma-spacing": [
35
+ "error",
36
+ {
37
+ before: false,
38
+ after: true
39
+ }
40
+ ],
41
+ "comma-style": ["error", "last"],
42
+ "computed-property-spacing": ["error", "never"],
43
+ "dot-location": ["error", "property"],
44
+ "eol-last": ["error", "always"],
45
+ "func-call-spacing": ["error", "never"],
46
+ "function-call-argument-newline": ["error", "consistent"],
47
+ "function-paren-newline": ["error", "multiline-arguments"],
48
+ "generator-star-spacing": [
49
+ "error",
50
+ {
51
+ before: false,
52
+ after: true
53
+ }
54
+ ],
55
+ "implicit-arrow-linebreak": ["error", "beside"],
56
+ indent: [
57
+ "error",
58
+ "tab",
59
+ { SwitchCase: 1 }
60
+ ],
61
+ "jsx-quotes": ["error", "prefer-double"],
62
+ "key-spacing": [
63
+ "error",
64
+ {
65
+ beforeColon: false,
66
+ afterColon: true,
67
+ mode: "strict"
68
+ }
69
+ ],
70
+ "keyword-spacing": [
71
+ "error",
72
+ {
73
+ before: true,
74
+ after: true
75
+ }
76
+ ],
77
+ "line-comment-position": ["error", { position: "above" }],
78
+ "linebreak-style": ["off"],
79
+ "lines-around-comment": [
80
+ "error",
81
+ {
82
+ afterBlockComment: false,
83
+ afterLineComment: false,
84
+ allowArrayEnd: false,
85
+ allowArrayStart: false,
86
+ allowBlockEnd: false,
87
+ allowBlockStart: false,
88
+ allowClassEnd: false,
89
+ allowClassStart: false,
90
+ allowObjectEnd: false,
91
+ allowObjectStart: false,
92
+ beforeBlockComment: true,
93
+ beforeLineComment: false
94
+ }
95
+ ],
96
+ "lines-between-class-members": ["error", "always"],
97
+ "max-len": [
98
+ "error",
99
+ {
100
+ code: maxLineLength,
101
+ tabWidth,
102
+ ignoreComments: false,
103
+ ignoreTrailingComments: false,
104
+ ignoreUrls: true,
105
+ ignoreStrings: false,
106
+ ignoreTemplateLiterals: true,
107
+ ignoreRegExpLiterals: true
108
+ }
109
+ ],
110
+ "max-statements-per-line": ["error", { max: 1 }],
111
+ "multiline-ternary": ["error", "always-multiline"],
112
+ "new-parens": ["error", "always"],
113
+ "newline-per-chained-call": [
114
+ "error",
115
+ {
116
+ ignoreChainWithDepth: maxIgnoredChainDepth
117
+ }
118
+ ],
119
+ "no-extra-parens": ["error", "functions"],
120
+ "no-multi-spaces": ["error", { exceptions: { Property: false } }],
121
+ "no-multiple-empty-lines": [
122
+ "error",
123
+ {
124
+ max: 1,
125
+ maxEOF: 1,
126
+ maxBOF: 0
127
+ }
128
+ ],
129
+ "no-tabs": ["off"],
130
+ "no-trailing-spaces": [
131
+ "error",
132
+ {
133
+ skipBlankLines: false,
134
+ ignoreComments: false
135
+ }
136
+ ],
137
+ "no-whitespace-before-property": ["error"],
138
+ "nonblock-statement-body-position": ["error", "beside"],
139
+ "object-curly-newline": [
140
+ "error",
141
+ {
142
+ multiline: true,
143
+ minProperties: minPropertiesForObjectNewline,
144
+ consistent: true
145
+ }
146
+ ],
147
+ "object-curly-spacing": ["error", "always"],
148
+ "object-property-newline": [
149
+ "error",
150
+ {
151
+ allowAllPropertiesOnSameLine: false
152
+ }
153
+ ],
154
+ "operator-linebreak": [
155
+ "error",
156
+ "after",
157
+ {
158
+ overrides: {
159
+ "?": "before",
160
+ ":": "before"
161
+ }
162
+ }
163
+ ],
164
+ "padded-blocks": [
165
+ "error",
166
+ {
167
+ blocks: "never",
168
+ classes: "always",
169
+ switches: "never"
170
+ }
171
+ ],
172
+ "padding-line-between-statements": [
173
+ "error",
174
+ {
175
+ blankLine: "always",
176
+ prev: "*",
177
+ next: "return"
178
+ },
179
+ {
180
+ blankLine: "always",
181
+ prev: [
182
+ "const",
183
+ "let",
184
+ "var"
185
+ ],
186
+ next: "*"
187
+ },
188
+ {
189
+ blankLine: "any",
190
+ prev: [
191
+ "const",
192
+ "let",
193
+ "var"
194
+ ],
195
+ next: [
196
+ "const",
197
+ "let",
198
+ "var"
199
+ ]
200
+ },
201
+ {
202
+ blankLine: "always",
203
+ prev: [
204
+ "return",
205
+ "break",
206
+ "block",
207
+ "block-like"
208
+ ],
209
+ next: ["case", "default"]
210
+ }
211
+ ],
212
+ quotes: ["error", "double"],
213
+ "rest-spread-spacing": ["error", "never"],
214
+ semi: ["error", "always"],
215
+ "semi-spacing": [
216
+ "error",
217
+ {
218
+ before: false,
219
+ after: true
220
+
221
+ }
222
+ ],
223
+ "semi-style": ["error", "last"],
224
+ "space-before-blocks": ["error", "always"],
225
+ "space-before-function-paren": [
226
+ "error",
227
+ {
228
+ anonymous: "always",
229
+ named: "never",
230
+ asyncArrow: "always"
231
+ }
232
+ ],
233
+ "space-in-parens": ["error", "never"],
234
+ "space-infix-ops": ["error", { int32Hint: false }],
235
+ "space-unary-ops": [
236
+ "error",
237
+ {
238
+ words: true,
239
+ nonwords: false,
240
+ overrides: {}
241
+ }
242
+ ],
243
+ "switch-colon-spacing": [
244
+ "error",
245
+ {
246
+ before: false,
247
+ after: true
248
+ }
249
+ ],
250
+ "template-curly-spacing": ["error", "never"],
251
+ "template-tag-spacing": ["error", "never"],
252
+ "unicode-bom": ["error", "never"],
253
+ "wrap-iife": ["error", "inside"],
254
+ "wrap-regex": ["off"],
255
+ "yield-star-spacing": [
256
+ "error",
257
+ {
258
+ before: false,
259
+ after: true
260
+ }
261
+ ]
262
+ };
@@ -0,0 +1,16 @@
1
+ export default {
2
+ "array-callback-return": ["error"],
3
+ "no-await-in-loop": ["off"],
4
+ "no-constant-binary-expression": ["error"],
5
+ "no-constructor-return": ["off"],
6
+ "no-duplicate-imports": ["error"],
7
+ "no-new-native-nonconstructor": ["error"],
8
+ "no-promise-executor-return": ["error"],
9
+ "no-self-compare": ["error"],
10
+ "no-template-curly-in-string": ["warn"],
11
+ "no-unmodified-loop-condition": ["error"],
12
+ "no-unreachable-loop": ["error"],
13
+ "no-unused-private-class-members": ["error"],
14
+ "no-use-before-define": ["error"],
15
+ "require-atomic-updates": ["error"]
16
+ };
package/rules/react.js ADDED
@@ -0,0 +1,4 @@
1
+ export default {
2
+ "react/jsx-uses-vars": "error",
3
+ "react/jsx-uses-react": "error"
4
+ };