@qlik/eslint-config 1.1.11 → 1.2.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 CHANGED
@@ -53,7 +53,7 @@ To get started, create `eslint.config.js` (if your package json has `"type": "mo
53
53
  If you are not building your project with TypeScript (using Webpack or Vite for example), then tell TypeScript to include
54
54
  all files by setting `"include": [".*", "**/*"]` in `tsconfig.json`.
55
55
 
56
- For a pure browser environment with no specific frameworks use:
56
+ For a pure browser environment with a bundler and no specific framework use:
57
57
 
58
58
  ```js
59
59
  // @ts-check
@@ -67,7 +67,7 @@ export default qlik.compose(
67
67
  );
68
68
  ```
69
69
 
70
- Using React with vitest:
70
+ Using React:
71
71
 
72
72
  ```js
73
73
  // @ts-check
@@ -81,6 +81,20 @@ export default qlik.compose(
81
81
  );
82
82
  ```
83
83
 
84
+ Using Pure ES modules in browser:
85
+
86
+ ```js
87
+ // @ts-check
88
+ import qlik from "@qlik/eslint-config";
89
+
90
+ export default qlik.compose(
91
+ ...qlik.configs.esbrowser, // based on the recommended config and adds specific es module rules (file endings)
92
+ {
93
+ ignores: ["dist", "node_modules"],
94
+ },
95
+ );
96
+ ```
97
+
84
98
  Using Svelte:
85
99
 
86
100
  ```js
@@ -141,6 +155,21 @@ export default qlik.compose(
141
155
  );
142
156
  ```
143
157
 
158
+ Example: Using React with vitest:
159
+
160
+ ```js
161
+ // @ts-check
162
+ import qlik from "@qlik/eslint-config";
163
+
164
+ export default qlik.compose(
165
+ ...qlik.configs.react, // based on the recommended config and adds react linting on .jsx and .tsx files
166
+ ...qlik.configs.vitest, // enable vitest linting on files inside __test(s)__ folder
167
+ {
168
+ ignores: ["dist", "node_modules"],
169
+ },
170
+ );
171
+ ```
172
+
144
173
  ## Using the named exports configs
145
174
 
146
175
  The different configs are also accessible through named imports. These configs can be used in specific scenarios where more
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qlik/eslint-config",
3
- "version": "1.1.11",
3
+ "version": "1.2.1",
4
4
  "description": "Qlik's ESLint configs",
5
5
  "repository": "git@github.com:qlik-oss/dev-tools-js.git",
6
6
  "license": "ISC",
@@ -15,34 +15,35 @@
15
15
  "!**/__tests__"
16
16
  ],
17
17
  "dependencies": {
18
- "@eslint-react/eslint-plugin": "^1.26.2",
19
- "@eslint/js": "^9.20.0",
20
- "@typescript-eslint/parser": "^8.24.1",
21
- "@typescript-eslint/utils": "^8.24.0",
22
- "@vitest/eslint-plugin": "^1.1.31",
18
+ "@eslint-react/eslint-plugin": "^1.30.1",
19
+ "@eslint/js": "^9.21.0",
20
+ "@typescript-eslint/parser": "^8.26.0",
21
+ "@typescript-eslint/utils": "^8.26.0",
22
+ "@vitest/eslint-plugin": "^1.1.36",
23
23
  "confusing-browser-globals": "^1.0.11",
24
- "eslint-config-prettier": "^10.0.1",
25
- "eslint-import-resolver-typescript": "^3.8.0",
24
+ "eslint-config-prettier": "^10.0.2",
25
+ "eslint-import-resolver-typescript": "^3.8.3",
26
26
  "eslint-plugin-import-x": "^4.6.1",
27
27
  "eslint-plugin-jest": "^28.11.0",
28
28
  "eslint-plugin-jsx-a11y": "^6.10.2",
29
29
  "eslint-plugin-playwright": "^2.2.0",
30
30
  "eslint-plugin-react": "^7.37.4",
31
- "eslint-plugin-react-hooks": "^5.1.0",
32
- "eslint-plugin-svelte": "^2.46.1",
31
+ "eslint-plugin-react-hooks": "^5.2.0",
32
+ "eslint-plugin-svelte": "^3.0.2",
33
33
  "eslint-plugin-testing-library": "^7.1.1",
34
- "globals": "^15.15.0",
35
- "svelte-eslint-parser": "^0.43.0",
36
- "typescript-eslint": "^8.24.0"
34
+ "globals": "^16.0.0",
35
+ "svelte-eslint-parser": "^1.0.0",
36
+ "typescript-eslint": "^8.26.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/confusing-browser-globals": "^1.0.3",
40
40
  "@types/eslint-config-prettier": "^6.11.3",
41
41
  "@types/eslint-plugin-jsx-a11y": "^6.10.0",
42
- "@types/eslint__js": "^8.42.3",
43
- "eslint": "^9.20.1",
44
- "prettier": "^3.5.1",
45
- "vitest": "^3.0.5",
42
+ "@types/eslint__js": "^9.14.0",
43
+ "@types/node": "^22.13.9",
44
+ "eslint": "^9.21.0",
45
+ "prettier": "^3.5.3",
46
+ "vitest": "^3.0.7",
46
47
  "@qlik/tsconfig": "0.3.0"
47
48
  },
48
49
  "peerDependencies": {
@@ -0,0 +1,71 @@
1
+ // @ts-check
2
+ import prettier from "eslint-config-prettier";
3
+ import globals from "globals";
4
+ import { mergeConfigs } from "../utils/config.js";
5
+ import { recommendedJS, recommendedTS } from "./recommended.js";
6
+
7
+ /**
8
+ * @satisfies {import("../types/index.js").ESLintFlatConfig["rules"]}
9
+ */
10
+ const browserEsmRules = {
11
+ // modify rules for browser esm here
12
+
13
+ // Ensure consistent use of file extension within the import path
14
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/extensions.md
15
+ "import-x/extensions": [
16
+ "error",
17
+ "ignorePackages",
18
+ {
19
+ ts: "never",
20
+ mts: "never",
21
+ tsx: "never",
22
+ },
23
+ ],
24
+ };
25
+
26
+ /**
27
+ * @type {import("../types/index.js").ESLintFlatConfig}
28
+ */
29
+ const esbrowserJS = mergeConfigs(
30
+ // base it on the recommended javascript config
31
+ recommendedJS,
32
+ // add qlik's recommended node esm config for javascript
33
+ {
34
+ name: "esbrowser-js",
35
+ files: ["**/*.{js,mjs}"],
36
+ languageOptions: {
37
+ globals: globals.browser,
38
+ sourceType: "module",
39
+ },
40
+ rules: {
41
+ ...browserEsmRules,
42
+ // modify javascript specific rules for node esm here if needed
43
+ },
44
+ },
45
+ prettier,
46
+ );
47
+
48
+ /**
49
+ * @type {import("../types/index.js").ESLintFlatConfig}
50
+ */
51
+ const esbrowserTS = mergeConfigs(
52
+ // base it on the recommended typescript config
53
+ recommendedTS,
54
+ // add qlik's recommended node esm config for typescript
55
+ {
56
+ name: "esbrowser-ts",
57
+ files: ["**/*.{ts,mts}"],
58
+ languageOptions: {
59
+ globals: globals.browser,
60
+ sourceType: "module",
61
+ },
62
+ rules: {
63
+ ...browserEsmRules,
64
+ // modify typescript specific rules for node esm here if needed
65
+ },
66
+ },
67
+ prettier,
68
+ );
69
+
70
+ export default [esbrowserJS, esbrowserTS];
71
+ export { esbrowserJS, esbrowserTS };
package/src/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import cjs, { cjsJS, cjsTS } from "./configs/cjs.js";
2
+ import esbrowser, { esbrowserJS, esbrowserTS } from "./configs/esbrowser.js";
2
3
  import esm, { esmJS, esmTS } from "./configs/esm.js";
3
4
  import jest from "./configs/jest.js";
4
5
  import playwright from "./configs/playwright.js";
@@ -11,6 +12,7 @@ import compose from "./utils/compose.js";
11
12
  declare namespace qlikEslintConfig {
12
13
  export namespace configs {
13
14
  export { cjs };
15
+ export { esbrowser };
14
16
  export { esm };
15
17
  export { playwright };
16
18
  export { jest };
@@ -23,4 +25,16 @@ declare namespace qlikEslintConfig {
23
25
  }
24
26
 
25
27
  export default qlikEslintConfig;
26
- export { cjsJS, cjsTS, esmJS, esmTS, reactJS, reactTS, recommendedJS, recommendedTS, svelteJS };
28
+ export {
29
+ cjsJS,
30
+ cjsTS,
31
+ esbrowserJS,
32
+ esbrowserTS,
33
+ esmJS,
34
+ esmTS,
35
+ reactJS,
36
+ reactTS,
37
+ recommendedJS,
38
+ recommendedTS,
39
+ svelteJS,
40
+ };
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // Import ESLint configuration modules
2
2
  import cjs, { cjsJS, cjsTS } from "./configs/cjs.js";
3
+ import esbrowser, { esbrowserJS, esbrowserTS } from "./configs/esbrowser.js";
3
4
  import esm, { esmJS, esmTS } from "./configs/esm.js";
4
5
  import jest from "./configs/jest.js";
5
6
  import playwright from "./configs/playwright.js";
@@ -15,6 +16,7 @@ import compose from "./utils/compose.js";
15
16
  const qlikEslintConfig = {
16
17
  configs: {
17
18
  cjs,
19
+ esbrowser,
18
20
  esm,
19
21
  jest,
20
22
  playwright,
@@ -28,4 +30,16 @@ const qlikEslintConfig = {
28
30
 
29
31
  export default qlikEslintConfig;
30
32
 
31
- export { cjsJS, cjsTS, esmJS, esmTS, reactJS, reactTS, recommendedJS, recommendedTS, svelteJS };
33
+ export {
34
+ cjsJS,
35
+ cjsTS,
36
+ esbrowserJS,
37
+ esbrowserTS,
38
+ esmJS,
39
+ esmTS,
40
+ reactJS,
41
+ reactTS,
42
+ recommendedJS,
43
+ recommendedTS,
44
+ svelteJS,
45
+ };