@qlik/eslint-config 1.1.1 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qlik/eslint-config",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Qlik's ESLint configs",
5
5
  "repository": "git@github.com:qlik-oss/dev-tools-js.git",
6
6
  "license": "ISC",
@@ -21,6 +21,7 @@
21
21
  "@typescript-eslint/utils": "^8.16.0",
22
22
  "@vitest/eslint-plugin": "^1.1.11",
23
23
  "confusing-browser-globals": "^1.0.11",
24
+ "eslint-config-prettier": "^9.1.0",
24
25
  "eslint-import-resolver-typescript": "^3.6.3",
25
26
  "eslint-plugin-import-x": "^4.4.3",
26
27
  "eslint-plugin-jest": "^28.9.0",
@@ -36,6 +37,7 @@
36
37
  },
37
38
  "devDependencies": {
38
39
  "@types/confusing-browser-globals": "^1.0.3",
40
+ "@types/eslint-config-prettier": "^6.11.3",
39
41
  "@types/eslint-plugin-jsx-a11y": "^6.10.0",
40
42
  "@types/eslint__js": "^8.42.3",
41
43
  "eslint": "^9.15.0",
@@ -1,4 +1,5 @@
1
1
  // @ts-check
2
+ import prettier from "eslint-config-prettier";
2
3
  import globals from "globals";
3
4
  import { mergeConfigs } from "../utils/config.js";
4
5
  import { recommendedJS, recommendedTS } from "./recommended.js";
@@ -28,6 +29,7 @@ const cjsJS = mergeConfigs(
28
29
  },
29
30
  rules: cjsRules,
30
31
  },
32
+ prettier,
31
33
  );
32
34
 
33
35
  /**
@@ -49,6 +51,7 @@ const cjsTS = mergeConfigs(
49
51
  // modify ts specific rules for node here
50
52
  },
51
53
  },
54
+ prettier,
52
55
  );
53
56
 
54
57
  export default [cjsJS, cjsTS];
@@ -1,4 +1,5 @@
1
1
  // @ts-check
2
+ import prettier from "eslint-config-prettier";
2
3
  import globals from "globals";
3
4
  import { mergeConfigs } from "../utils/config.js";
4
5
  import { recommendedJS, recommendedTS } from "./recommended.js";
@@ -29,6 +30,7 @@ const esmJS = mergeConfigs(
29
30
  },
30
31
  rules: nodeEsmRules,
31
32
  },
33
+ prettier,
32
34
  );
33
35
 
34
36
  /**
@@ -50,6 +52,7 @@ const esmTS = mergeConfigs(
50
52
  // modify typescript specific rules for node esm here if needed
51
53
  },
52
54
  },
55
+ prettier,
53
56
  );
54
57
 
55
58
  export default [esmJS, esmTS];
@@ -1,5 +1,6 @@
1
1
  // @ts-check
2
2
  import react from "@eslint-react/eslint-plugin";
3
+ import prettier from "eslint-config-prettier";
3
4
  import jsxA11y from "eslint-plugin-jsx-a11y";
4
5
  import eslintPluginReact from "eslint-plugin-react";
5
6
  // @ts-expect-error no types for this plugin yet
@@ -16,38 +17,45 @@ const reactPlugin = eslintPluginReact;
16
17
  /**
17
18
  * @type {import("../types/index.js").ESLintFlatConfig}
18
19
  */
19
- const reactBaseConfig = {
20
- languageOptions: {
21
- parserOptions: {
22
- ecmaFeatures: {
23
- jsx: true,
24
- },
25
- jsxPragma: null, // for @typescript/eslint-parser
20
+ const reactBaseConfig = mergeConfigs(
21
+ // base it on the recommended react plugins config
22
+ react.configs.recommended,
23
+ reactPlugin.configs.flat.recommended,
24
+ jsxA11y.flatConfigs.recommended,
25
+ // add react-hooks plugin config (no recommended flat config YET!)
26
+ {
27
+ plugins: {
28
+ "react-hooks": reactHooks,
29
+ },
30
+ rules: {
31
+ ...reactHooks.configs.recommended.rules,
26
32
  },
27
33
  },
28
34
 
29
- plugins: { ...react.configs.recommended.plugins, react: reactPlugin, "jsx-a11y": jsxA11y, "react-hooks": reactHooks },
35
+ // add qlik's recommended react config
36
+ {
37
+ languageOptions: {
38
+ parserOptions: {
39
+ ecmaFeatures: {
40
+ jsx: true,
41
+ },
42
+ jsxPragma: null, // for @typescript/eslint-parser
43
+ },
44
+ },
30
45
 
31
- settings: {
32
- ...react.configs.recommended.settings,
33
- react: {
34
- version: "detect",
46
+ settings: {
47
+ react: {
48
+ version: "detect",
49
+ },
35
50
  },
36
- },
37
51
 
38
- rules: {
39
- // react plugin
40
- ...reactPlugin.configs.flat.recommended.rules,
41
- ...reactRules,
42
- // jsx-a11y plugin
43
- ...jsxA11y.flatConfigs.recommended.rules,
44
- ...reactA11yRules,
45
- ...react.configs.recommended.rules,
46
- // react-hooks plugin
47
- ...reactHooks.configs.recommended.rules,
48
- ...reactHooksRules,
52
+ rules: {
53
+ ...reactRules,
54
+ ...reactA11yRules,
55
+ ...reactHooksRules,
56
+ },
49
57
  },
50
- };
58
+ );
51
59
 
52
60
  /**
53
61
  * @type {import("../types/index.js").ESLintFlatConfig}
@@ -66,6 +74,7 @@ const reactJS = mergeConfigs(
66
74
  "react/jsx-filename-extension": [2, { extensions: [".js", ".jsx"] }],
67
75
  },
68
76
  },
77
+ prettier,
69
78
  );
70
79
 
71
80
  /**
@@ -85,6 +94,7 @@ const reactTS = mergeConfigs(
85
94
  "react/jsx-filename-extension": [2, { extensions: [".js", ".jsx", ".ts", ".tsx"] }],
86
95
  },
87
96
  },
97
+ prettier,
88
98
  );
89
99
 
90
100
  export default [reactJS, reactTS];
@@ -1,6 +1,7 @@
1
1
  // @ts-check
2
2
  import js from "@eslint/js";
3
3
  import tsParser from "@typescript-eslint/parser";
4
+ import prettier from "eslint-config-prettier";
4
5
  import eslintPluginImportX from "eslint-plugin-import-x";
5
6
  import globals from "globals";
6
7
  import tsconfig from "typescript-eslint";
@@ -43,6 +44,7 @@ const recommendedJS = mergeConfigs(
43
44
  name: "recommended-js",
44
45
  files: ["**/*.js", "**/*.mjs", "**/*.cjs"],
45
46
  },
47
+ prettier,
46
48
  );
47
49
 
48
50
  /**
@@ -67,6 +69,7 @@ const recommendedTS = mergeConfigs(
67
69
  },
68
70
  rules: typescriptRules,
69
71
  },
72
+ prettier,
70
73
  );
71
74
 
72
75
  export default [recommendedJS, recommendedTS];
@@ -30,10 +30,6 @@ const rules = {
30
30
  // https://eslint.org/docs/rules/consistent-return
31
31
  "consistent-return": "error",
32
32
 
33
- // specify curly brace conventions for all control statements
34
- // https://eslint.org/docs/rules/curly
35
- curly: ["error", "multi-line"], // multiline
36
-
37
33
  // require default case in switch statements
38
34
  // https://eslint.org/docs/rules/default-case
39
35
  "default-case": ["error", { commentPattern: "^no default$" }],
@@ -502,7 +498,7 @@ const rules = {
502
498
 
503
499
  // Avoid code that looks like two expressions but is actually one
504
500
  // https://eslint.org/docs/rules/no-unexpected-multiline
505
- "no-unexpected-multiline": "error",
501
+ "no-unexpected-multiline": "off",
506
502
 
507
503
  // disallow unreachable statements after a return, throw, continue, or break statement
508
504
  "no-unreachable": "error",
@@ -128,7 +128,7 @@ const rules = {
128
128
  "import-x/no-self-import": "error",
129
129
  // Forbid cyclical dependencies between modules
130
130
  // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-cycle.md
131
- "import-x/no-cycle": ["error", { maxDepth: "∞" }],
131
+ "import-x/no-cycle": ["error", { ignoreExternal: true }],
132
132
  // Ensures that there are no useless path segments
133
133
  // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-useless-path-segments.md
134
134
  "import-x/no-useless-path-segments": ["error", { commonjs: true }],
@@ -43,26 +43,6 @@ const rules = {
43
43
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
44
44
  "react/jsx-boolean-value": ["error", "never", { always: [] }],
45
45
 
46
- // Validate closing bracket location in JSX
47
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
48
- "react/jsx-closing-bracket-location": ["error", "line-aligned"],
49
-
50
- // Validate closing tag location in JSX
51
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
52
- "react/jsx-closing-tag-location": "error",
53
-
54
- // Enforce or disallow spaces inside of curly braces in JSX attributes
55
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
56
- "react/jsx-curly-spacing": ["error", "never", { allowMultiline: true }],
57
-
58
- // Validate props indentation in JSX
59
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
60
- "react/jsx-indent-props": ["error", 2],
61
-
62
- // Limit maximum of props on a single line in JSX
63
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
64
- "react/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
65
-
66
46
  // Prevent usage of .bind() in JSX props
67
47
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
68
48
  "react/jsx-no-bind": [
@@ -215,22 +195,7 @@ const rules = {
215
195
 
216
196
  // Prevent missing parentheses around multilines JSX
217
197
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
218
- "react/jsx-wrap-multilines": [
219
- "error",
220
- {
221
- declaration: "parens-new-line",
222
- assignment: "parens-new-line",
223
- return: "parens-new-line",
224
- arrow: "parens-new-line",
225
- condition: "parens-new-line",
226
- logical: "parens-new-line",
227
- prop: "ignore",
228
- },
229
- ],
230
-
231
- // Require that the first prop in a JSX element be on a new line when the element is multiline
232
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
233
- "react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
198
+ "react/jsx-wrap-multilines": "off",
234
199
 
235
200
  // Stylistic, Prettier handles this.
236
201
  // Enforce spacing around jsx equals signs
@@ -290,15 +255,7 @@ const rules = {
290
255
 
291
256
  // Validate whitespace in and around the JSX opening and closing brackets
292
257
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
293
- "react/jsx-tag-spacing": [
294
- "error",
295
- {
296
- closingSlash: "never",
297
- beforeSelfClosing: "always",
298
- afterOpening: "never",
299
- beforeClosing: "never",
300
- },
301
- ],
258
+ "react/jsx-tag-spacing": "off",
302
259
 
303
260
  // Prevent usage of Array index in keys
304
261
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
@@ -369,22 +326,12 @@ const rules = {
369
326
 
370
327
  // Disallow multiple spaces between inline JSX props
371
328
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md
372
- "react/jsx-props-no-multi-spaces": "error",
329
+ "react/jsx-props-no-multi-spaces": "off",
373
330
 
374
331
  // Enforce shorthand or standard form for React fragments
375
332
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
376
333
  "react/jsx-fragments": ["error", "syntax"],
377
334
 
378
- // Enforce linebreaks in curly braces in JSX attributes and expressions.
379
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
380
- "react/jsx-curly-newline": [
381
- "error",
382
- {
383
- multiline: "consistent",
384
- singleline: "consistent",
385
- },
386
- ],
387
-
388
335
  // Enforce state initialization style
389
336
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
390
337
  "react/state-in-constructor": ["error", "never"],
@@ -1,4 +1,5 @@
1
1
  // @ts-check
2
+ import prettier from "eslint-config-prettier";
2
3
  import eslintPluginSvelte from "eslint-plugin-svelte";
3
4
  import svelteParser from "svelte-eslint-parser";
4
5
  import tsEslint from "typescript-eslint";
@@ -48,6 +49,7 @@ const svelteSvelte = mergeConfigs(
48
49
  "no-unused-vars": "off",
49
50
  },
50
51
  },
52
+ prettier,
51
53
  );
52
54
 
53
55
  export default [recommendedJS, recommendedTS, svelteSvelte];