@dvukovic/style-guide 0.3.97 → 0.3.98

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.
Files changed (58) hide show
  1. package/README.md +93 -159
  2. package/package.json +16 -16
  3. package/src/cspell/base.txt +12 -0
  4. package/src/eslint/configs/core.js +42 -30
  5. package/src/eslint/configs/core.test.js +4 -4
  6. package/src/eslint/configs/jest.js +26 -3
  7. package/src/eslint/configs/jest.test.js +3 -3
  8. package/src/eslint/configs/mobx.js +15 -3
  9. package/src/eslint/configs/mobx.test.js +3 -3
  10. package/src/eslint/configs/next.js +15 -3
  11. package/src/eslint/configs/next.test.js +3 -3
  12. package/src/eslint/configs/node.js +16 -4
  13. package/src/eslint/configs/node.test.js +3 -3
  14. package/src/eslint/configs/playwright.js +26 -3
  15. package/src/eslint/configs/playwright.test.js +3 -3
  16. package/src/eslint/configs/react.js +16 -4
  17. package/src/eslint/configs/react.test.js +3 -3
  18. package/src/eslint/configs/storybook.js +15 -3
  19. package/src/eslint/configs/storybook.test.js +3 -3
  20. package/src/eslint/configs/typescript-strict.js +14 -2
  21. package/src/eslint/configs/typescript-strict.test.js +6 -4
  22. package/src/eslint/configs/typescript.js +37 -4
  23. package/src/eslint/configs/typescript.test.js +6 -4
  24. package/src/eslint/configs/vitest.js +26 -3
  25. package/src/eslint/configs/vitest.test.js +3 -3
  26. package/src/eslint/index.js +25 -0
  27. package/src/eslint/plugins/dvukovic.js +15 -0
  28. package/src/eslint/plugins/es-x.js +7 -6
  29. package/src/eslint/plugins/eslint-comments.js +4 -5
  30. package/src/eslint/plugins/eslint.js +9 -3
  31. package/src/eslint/plugins/eslint.test.js +42 -0
  32. package/src/eslint/plugins/import-x.js +4 -5
  33. package/src/eslint/plugins/jest.js +4 -5
  34. package/src/eslint/plugins/mobx.js +4 -5
  35. package/src/eslint/plugins/n.js +4 -5
  36. package/src/eslint/plugins/next.js +4 -5
  37. package/src/eslint/plugins/playwright.js +4 -5
  38. package/src/eslint/plugins/promise.js +4 -5
  39. package/src/eslint/plugins/react-hooks.js +4 -5
  40. package/src/eslint/plugins/react.js +4 -5
  41. package/src/eslint/plugins/rimac.js +4 -5
  42. package/src/eslint/plugins/security-node.js +4 -5
  43. package/src/eslint/plugins/simple-import-sort.js +4 -5
  44. package/src/eslint/plugins/sonarjs.js +261 -37
  45. package/src/eslint/plugins/sort-destructure-keys.js +4 -5
  46. package/src/eslint/plugins/sort-keys-fix.js +4 -5
  47. package/src/eslint/plugins/storybook.js +4 -5
  48. package/src/eslint/plugins/stylistic.js +4 -5
  49. package/src/eslint/plugins/typescript-eslint.js +4 -5
  50. package/src/eslint/plugins/typescript-sort-keys.js +4 -5
  51. package/src/eslint/plugins/unicorn.js +4 -5
  52. package/src/eslint/plugins/unused-imports.js +4 -5
  53. package/src/eslint/plugins/vitest.js +4 -5
  54. package/src/eslint/rules/no-commented-out-code/no-commented-out-code.js +80 -0
  55. package/src/eslint/rules/no-commented-out-code/no-commented-out-code.test.js +89 -0
  56. package/src/eslint/rules/no-commented-out-code/no-commented-out-code.utils.js +119 -0
  57. package/src/eslint/types.js +19 -0
  58. package/src/eslint/plugins/etc.js +0 -3
package/README.md CHANGED
@@ -1,187 +1,121 @@
1
- # Style Guide
1
+ # @dvukovic/style-guide
2
2
 
3
- Linting and formatting configuration for TypeScript/JavaScript projects.
3
+ Personal style guide with ESLint, Prettier, and other code quality tools.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- yarn add -D @dvukovic/style-guide eslint prettier cspell stylelint npm-package-json-lint
8
+ yarn add -D @dvukovic/style-guide eslint prettier cspell stylelint
9
9
  ```
10
10
 
11
- ## Setup
12
-
13
- Add these scripts to your `package.json`:
14
-
15
- ```json
16
- {
17
- "scripts": {
18
- "lint": "yarn lint:eslint && yarn lint:prettier && yarn lint:stylelint && yarn lint:spell && yarn lint:package-json",
19
- "lint:eslint": "eslint . --cache --concurrency=auto",
20
- "lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix",
21
- "lint:package-json": "npmPkgJsonLint --configFile ./.packagerc.js .",
22
- "lint:prettier": "prettier --check --cache '**/*.{json,yaml,yml,md,css,html}'",
23
- "lint:spell": "cspell --config ./.cspellrc.js --no-progress --no-summary --unique '**'",
24
- "lint:stylelint": "stylelint ./**/*.css --cache"
25
- }
26
- }
27
- ```
11
+ ## ESLint Configuration
28
12
 
29
- Add to `.gitignore`:
13
+ ### Basic Usage
30
14
 
31
- ```
32
- .eslintcache
33
- .stylelintcache
34
- ```
15
+ Create an `eslint.config.js` file in your project root:
35
16
 
36
- ---
37
-
38
- ## ESLint
39
-
40
- Prettier is integrated into ESLint via `eslint-plugin-prettier` for JS/TS files. The separate
41
- `lint:prettier` script handles JSON, YAML, MD, and other files.
42
-
43
- Create `eslint.config.js`:
44
-
45
- ```javascript
46
- import tseslint from "typescript-eslint"
47
-
48
- import core from "@dvukovic/style-guide/src/eslint/configs/core.js"
49
- import jest from "@dvukovic/style-guide/src/eslint/configs/jest.js"
50
- import mobx from "@dvukovic/style-guide/src/eslint/configs/mobx.js"
51
- import next from "@dvukovic/style-guide/src/eslint/configs/next.js"
52
- import node from "@dvukovic/style-guide/src/eslint/configs/node.js"
53
- import playwright from "@dvukovic/style-guide/src/eslint/configs/playwright.js"
54
- import react from "@dvukovic/style-guide/src/eslint/configs/react.js"
55
- import storybook from "@dvukovic/style-guide/src/eslint/configs/storybook.js"
56
- import typescript from "@dvukovic/style-guide/src/eslint/configs/typescript.js"
57
- import typescriptStrict from "@dvukovic/style-guide/src/eslint/configs/typescript-strict.js"
58
- import vitest from "@dvukovic/style-guide/src/eslint/configs/vitest.js"
59
-
60
- export default tseslint.config(
61
- { ignores: ["node_modules", ".next", "dist", "build"] },
62
- ...core,
63
- ...node,
64
- ...next,
65
- ...mobx,
66
- ...react,
67
- {
68
- languageOptions: {
69
- parser: tseslint.parser,
70
- parserOptions: {
71
- project: "./tsconfig.json",
72
- },
73
- },
74
- },
75
- {
76
- files: ["**/*.ts", "**/*.tsx"],
77
- extends: [...typescript, ...typescriptStrict],
78
- },
79
- {
80
- files: ["**/*.test.ts"],
81
- extends: [...jest],
82
- },
83
- {
84
- files: ["**/*.test.ts"],
85
- extends: [...vitest],
86
- },
87
- {
88
- files: ["**/*.ui.test.ts"],
89
- extends: [...playwright],
90
- },
91
- {
92
- files: ["**/*.stories.ts", "**/*.stories.tsx"],
93
- extends: [...storybook],
94
- },
95
- )
17
+ ```js
18
+ import { customDefineConfig, core, typescript } from "@dvukovic/style-guide/eslint"
19
+
20
+ export default customDefineConfig(["dist/**", "build/**"], [core(), typescript()])
96
21
  ```
97
22
 
98
23
  ### Available Configs
99
24
 
100
- | Config | Description |
101
- | ------------------- | -------------------------------- |
102
- | `core` | Base JavaScript rules + Prettier |
103
- | `node` | Node.js specific rules |
104
- | `react` | React and JSX rules |
105
- | `next` | Next.js specific rules |
106
- | `mobx` | MobX state management rules |
107
- | `typescript` | TypeScript rules |
108
- | `typescript-strict` | Strict TypeScript rules |
109
- | `jest` | Jest testing rules |
110
- | `vitest` | Vitest testing rules |
111
- | `playwright` | Playwright E2E testing rules |
112
- | `storybook` | Storybook rules |
113
-
114
- ---
115
-
116
- ## Prettier
117
-
118
- Create `prettier.config.js`:
119
-
120
- ```javascript
121
- import prettierConfig from "@dvukovic/style-guide/src/prettier/configs/core.js"
122
-
123
- /** @type {import("prettier").Config} */
124
- export default {
125
- ...prettierConfig,
126
- }
25
+ Each config is a factory function that returns ESLint configuration:
26
+
27
+ - `core()` - Essential rules for all JavaScript/TypeScript projects
28
+ - `node()` - Node.js specific rules
29
+ - `react()` - React framework rules
30
+ - `typescript()` - TypeScript parser and rules
31
+ - `typescriptStrict()` - Additional strict TypeScript rules
32
+ - `jest()` - Jest testing framework
33
+ - `vitest()` - Vitest testing framework
34
+ - `playwright()` - Playwright e2e testing
35
+ - `mobx()` - MobX state management
36
+ - `next()` - Next.js framework
37
+ - `storybook()` - Storybook
38
+
39
+ ### Customizing Configs
40
+
41
+ Each factory function accepts a `config` parameter to extend or override settings:
42
+
43
+ ```js
44
+ import { customDefineConfig, core, typescript } from "@dvukovic/style-guide/eslint"
45
+
46
+ export default customDefineConfig(
47
+ [],
48
+ [
49
+ core(),
50
+ typescript({
51
+ rules: {
52
+ "@typescript-eslint/no-unused-vars": "warn",
53
+ },
54
+ }),
55
+ ],
56
+ )
127
57
  ```
128
58
 
129
- ---
59
+ ### Complete Example
60
+
61
+ A full-featured project (this is the actual config used by this package):
62
+
63
+ ```js
64
+ import {
65
+ customDefineConfig,
66
+ core,
67
+ node,
68
+ mobx,
69
+ react,
70
+ next,
71
+ typescript,
72
+ typescriptStrict,
73
+ jest,
74
+ vitest,
75
+ playwright,
76
+ } from "@dvukovic/style-guide/eslint"
77
+
78
+ export default customDefineConfig(
79
+ ["node_modules"],
80
+ [
81
+ core(),
82
+ node(),
83
+ mobx(),
84
+ react(),
85
+ next(),
86
+ typescript(),
87
+ typescriptStrict(),
88
+ jest(),
89
+ vitest(),
90
+ playwright(),
91
+ ],
92
+ )
93
+ ```
130
94
 
131
- ## Stylelint
95
+ ## Prettier Configuration
132
96
 
133
- Create `.stylelintrc.js`:
97
+ ```js
98
+ import { prettier } from "@dvukovic/style-guide/prettier"
134
99
 
135
- ```javascript
136
- /** @type {import("stylelint").Config} */
137
- export default {
138
- extends: "@dvukovic/style-guide/src/stylelint/configs/core.js",
139
- }
100
+ export default prettier
140
101
  ```
141
102
 
142
- ---
143
-
144
- ## CSpell
145
-
146
- Create `.cspellrc.js`:
147
-
148
- ```javascript
149
- /** @type {import("cspell").FileSettings} */
150
- export default {
151
- cache: {
152
- cacheLocation: "./node_modules/.cache/cspell",
153
- useCache: true,
154
- },
155
- caseSensitive: false,
156
- dictionaries: ["shared"],
157
- dictionaryDefinitions: [
158
- {
159
- name: "shared",
160
- path: "./node_modules/@dvukovic/style-guide/src/cspell/base.txt",
161
- },
162
- ],
163
- useGitignore: true,
164
- }
165
- ```
103
+ ## Stylelint Configuration
104
+
105
+ ```js
106
+ import { stylelint } from "@dvukovic/style-guide/stylelint"
166
107
 
167
- ---
108
+ export default stylelint
109
+ ```
168
110
 
169
- ## Package JSON Lint
111
+ ## Package.json Configuration
170
112
 
171
- Create `.packagerc.js`:
113
+ ```js
114
+ import { packageJson } from "@dvukovic/style-guide/package-json"
172
115
 
173
- ```javascript
174
- /** @type {import("npm-package-json-lint").NpmPackageJsonLint} */
175
- export default {
176
- extends: "@dvukovic/style-guide/src/package-json/configs/core.js",
177
- }
116
+ export default packageJson
178
117
  ```
179
118
 
180
- ---
181
-
182
- ## Requirements
119
+ ## License
183
120
 
184
- - Node.js >= 20.0.0
185
- - ESLint 9+
186
- - Prettier 3+
187
- - Stylelint 16+
121
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvukovic/style-guide",
3
- "version": "0.3.97",
3
+ "version": "0.3.98",
4
4
  "description": "My own style guide",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,8 +21,8 @@
21
21
  "scripts": {
22
22
  "lint": "yarn lint:eslint && yarn lint:prettier && yarn lint:stylelint && yarn lint:spell",
23
23
  "lint:eslint": "eslint . --cache --concurrency=auto",
24
- "lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix",
25
- "lint:prettier": "prettier --check --cache '**/*.{json,yaml,yml,md,css,html}'",
24
+ "lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix && yarn lint:spell",
25
+ "lint:prettier": "prettier --check --cache .",
26
26
  "lint:spell": "cspell --config ./.cspellrc.js --no-progress --no-summary --unique '**'",
27
27
  "lint:stylelint": "stylelint ./**/*.css --cache",
28
28
  "release": "release-it",
@@ -30,14 +30,14 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
33
- "@next/eslint-plugin-next": "16.0.6",
33
+ "@eslint/compat": "^2.0.0",
34
+ "@next/eslint-plugin-next": "16.0.7",
34
35
  "@prettier/plugin-xml": "3.4.2",
35
36
  "@rimac-technology/eslint-plugin": "1.5.0",
36
37
  "@stylistic/eslint-plugin": "5.6.1",
37
- "@typescript-eslint/parser": "8.48.0",
38
+ "@typescript-eslint/parser": "8.48.1",
38
39
  "@vitest/eslint-plugin": "1.5.1",
39
- "eslint-plugin-es-x": "9.2.0",
40
- "eslint-plugin-etc": "2.0.3",
40
+ "eslint-plugin-es-x": "9.3.0",
41
41
  "eslint-plugin-import-x": "4.16.1",
42
42
  "eslint-plugin-jest": "29.2.1",
43
43
  "eslint-plugin-mobx": "0.0.13",
@@ -51,13 +51,13 @@
51
51
  "eslint-plugin-sonarjs": "3.0.5",
52
52
  "eslint-plugin-sort-destructure-keys": "2.0.0",
53
53
  "eslint-plugin-sort-keys-fix": "1.1.2",
54
- "eslint-plugin-storybook": "10.1.2",
54
+ "eslint-plugin-storybook": "10.1.4",
55
55
  "eslint-plugin-typescript-sort-keys": "3.3.0",
56
56
  "eslint-plugin-unicorn": "62.0.0",
57
57
  "eslint-plugin-unused-imports": "4.3.0",
58
58
  "globals": "16.5.0",
59
59
  "prettier-plugin-embed": "0.5.0",
60
- "prettier-plugin-jsdoc": "1.7.0",
60
+ "prettier-plugin-jsdoc": "1.8.0",
61
61
  "prettier-plugin-packagejson": "2.5.20",
62
62
  "prettier-plugin-prisma": "5.0.0",
63
63
  "prettier-plugin-sh": "0.18.0",
@@ -66,25 +66,25 @@
66
66
  "prettier-plugin-toml": "2.0.6",
67
67
  "stylelint-no-unused-selectors": "1.0.40",
68
68
  "stylelint-order": "7.0.0",
69
- "typescript-eslint": "8.48.0"
69
+ "typescript-eslint": "8.48.1"
70
70
  },
71
71
  "devDependencies": {
72
- "@storybook/react": "10.1.2",
72
+ "@storybook/react": "10.1.4",
73
73
  "@types/eslint": "9.6.1",
74
74
  "@types/jest": "30.0.0",
75
75
  "@types/node": "24.10.1",
76
76
  "@types/react": "19.2.7",
77
- "cspell": "9.3.2",
77
+ "cspell": "9.4.0",
78
78
  "eslint": "9.39.1",
79
79
  "jest": "30.2.0",
80
80
  "npm-package-json-lint": "9.0.0",
81
- "prettier": "3.7.3",
82
- "react": "19.2.0",
81
+ "prettier": "3.7.4",
82
+ "react": "19.2.1",
83
83
  "release-it": "19.0.6",
84
- "storybook": "^10.1.2",
84
+ "storybook": "^10.1.4",
85
85
  "stylelint": "16.26.1",
86
86
  "typescript": "5.9.3",
87
- "vitest": "^4.0.14"
87
+ "vitest": "^4.0.15"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "cspell": "9",
@@ -113,3 +113,15 @@ speculationrules
113
113
  hrefs
114
114
  supabase
115
115
  tslog
116
+ pablle
117
+ fkey
118
+ msword
119
+ openxmlformats
120
+ officedocument
121
+ wordprocessingml
122
+ presentationml
123
+ spreadsheetml
124
+ pageleave
125
+ opensearchservice
126
+ httponly
127
+ unthrown
@@ -1,33 +1,45 @@
1
- import esXPlugin from "../plugins/es-x.js"
2
- import eslintPlugin from "../plugins/eslint.js"
3
- import eslintCommentsPlugin from "../plugins/eslint-comments.js"
4
- import etcPlugin from "../plugins/etc.js"
5
- import importXPlugin from "../plugins/import-x.js"
6
- import promisePlugin from "../plugins/promise.js"
7
- import rimacPlugin from "../plugins/rimac.js"
8
- import simpleImportSortPlugin from "../plugins/simple-import-sort.js"
9
- import sonarjsPlugin from "../plugins/sonarjs.js"
10
- import sortDestructureKeysPlugin from "../plugins/sort-destructure-keys.js"
11
- import sortKeysFixPlugin from "../plugins/sort-keys-fix.js"
12
- import stylisticPlugin from "../plugins/stylistic.js"
13
- import unicornPlugin from "../plugins/unicorn.js"
14
- import unusedImportsPlugin from "../plugins/unused-imports.js"
1
+ import { dvukovic } from "../plugins/dvukovic.js"
2
+ import { esX } from "../plugins/es-x.js"
3
+ import { eslint } from "../plugins/eslint.js"
4
+ import { eslintComments } from "../plugins/eslint-comments.js"
5
+ import { importX } from "../plugins/import-x.js"
6
+ import { promise } from "../plugins/promise.js"
7
+ import { rimac } from "../plugins/rimac.js"
8
+ import { simpleImportSort } from "../plugins/simple-import-sort.js"
9
+ import { sonarjs } from "../plugins/sonarjs.js"
10
+ import { sortDestructureKeys } from "../plugins/sort-destructure-keys.js"
11
+ import { sortKeysFix } from "../plugins/sort-keys-fix.js"
12
+ import { stylistic } from "../plugins/stylistic.js"
13
+ import { unicorn } from "../plugins/unicorn.js"
14
+ import { unusedImports } from "../plugins/unused-imports.js"
15
15
 
16
- const coreConfig = [
17
- eslintPlugin,
18
- esXPlugin,
19
- eslintCommentsPlugin,
20
- promisePlugin,
21
- unicornPlugin,
22
- unusedImportsPlugin,
23
- importXPlugin,
24
- sonarjsPlugin,
25
- etcPlugin,
26
- sortKeysFixPlugin,
27
- sortDestructureKeysPlugin,
28
- stylisticPlugin,
29
- simpleImportSortPlugin,
30
- rimacPlugin,
16
+ export const coreConfig = [
17
+ esX,
18
+ eslint,
19
+ eslintComments,
20
+ importX,
21
+ promise,
22
+ rimac,
23
+ simpleImportSort,
24
+ sonarjs,
25
+ sortDestructureKeys,
26
+ sortKeysFix,
27
+ stylistic,
28
+ unicorn,
29
+ unusedImports,
30
+ dvukovic,
31
31
  ]
32
32
 
33
- export default coreConfig
33
+ /**
34
+ * Core ESLint configuration with essential rules and plugins
35
+ *
36
+ * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
37
+ * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
38
+ */
39
+ export function core(config) {
40
+ return {
41
+ extends: [...coreConfig, ...(config?.extends ?? [])],
42
+ files: ["**/*.js", "**/*.cjs", "**/*.mjs", "**/*.ts", "**/*.tsx"],
43
+ ...config,
44
+ }
45
+ }
@@ -1,9 +1,9 @@
1
1
  import { ESLint } from "eslint"
2
2
 
3
- import config from "./core.js"
3
+ import { coreConfig } from "./core.js"
4
4
 
5
5
  const eslint = new ESLint({
6
- overrideConfig: config,
6
+ overrideConfig: coreConfig,
7
7
  overrideConfigFile: true,
8
8
  })
9
9
 
@@ -12,12 +12,12 @@ describe("core", () => {
12
12
  const results = await eslint.lintText("const x = 1\n", { filePath: "test.js" })
13
13
 
14
14
  expect(results).toBeDefined()
15
- expect(results[0].fatalErrorCount).toBe(0)
15
+ expect(results[0]?.fatalErrorCount).toBe(0)
16
16
  })
17
17
 
18
18
  test("detects violations", async () => {
19
19
  const results = await eslint.lintText("var x = 1\n", { filePath: "test.js" })
20
20
 
21
- expect(results[0].errorCount).toBeGreaterThan(0)
21
+ expect(results[0]?.errorCount).toBeGreaterThan(0)
22
22
  })
23
23
  })
@@ -1,5 +1,28 @@
1
- import jestPlugin from "../plugins/jest.js"
1
+ import { jest as jestPlugin } from "../plugins/jest.js"
2
2
 
3
- const jestConfig = [jestPlugin]
3
+ export const jestConfig = [jestPlugin]
4
4
 
5
- export default jestConfig
5
+ /**
6
+ * Jest testing framework configuration
7
+ *
8
+ * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
9
+ * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
10
+ */
11
+ export function jest(config) {
12
+ return {
13
+ extends: [...jestConfig, ...(config?.extends ?? [])],
14
+ files: [
15
+ "**/*.test.js",
16
+ "**/*.test.ts",
17
+ "**/*.spec.js",
18
+ "**/*.spec.ts",
19
+ "**/*.unit.test.js",
20
+ "**/*.unit.test.ts",
21
+ "**/*.int.test.js",
22
+ "**/*.int.test.ts",
23
+ "**/*.integration.test.js",
24
+ "**/*.integration.test.ts",
25
+ ],
26
+ ...config,
27
+ }
28
+ }
@@ -1,9 +1,9 @@
1
1
  import { ESLint } from "eslint"
2
2
 
3
- import config from "./jest.js"
3
+ import { jestConfig } from "./jest.js"
4
4
 
5
5
  const eslint = new ESLint({
6
- overrideConfig: config,
6
+ overrideConfig: jestConfig,
7
7
  overrideConfigFile: true,
8
8
  })
9
9
 
@@ -12,6 +12,6 @@ describe("jest", () => {
12
12
  const results = await eslint.lintText("const x = 1\n", { filePath: "test.test.js" })
13
13
 
14
14
  expect(results).toBeDefined()
15
- expect(results[0].fatalErrorCount).toBe(0)
15
+ expect(results[0]?.fatalErrorCount).toBe(0)
16
16
  })
17
17
  })
@@ -1,5 +1,17 @@
1
- import mobxPlugin from "../plugins/mobx.js"
1
+ import { mobx as mobxPlugin } from "../plugins/mobx.js"
2
2
 
3
- const mobxConfig = [mobxPlugin]
3
+ export const mobxConfig = [mobxPlugin]
4
4
 
5
- export default mobxConfig
5
+ /**
6
+ * MobX state management configuration
7
+ *
8
+ * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
9
+ * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
10
+ */
11
+ export function mobx(config) {
12
+ return {
13
+ extends: [...mobxConfig, ...(config?.extends ?? [])],
14
+ files: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
15
+ ...config,
16
+ }
17
+ }
@@ -1,9 +1,9 @@
1
1
  import { ESLint } from "eslint"
2
2
 
3
- import config from "./mobx.js"
3
+ import { mobxConfig } from "./mobx.js"
4
4
 
5
5
  const eslint = new ESLint({
6
- overrideConfig: config,
6
+ overrideConfig: mobxConfig,
7
7
  overrideConfigFile: true,
8
8
  })
9
9
 
@@ -12,6 +12,6 @@ describe("mobx", () => {
12
12
  const results = await eslint.lintText("const x = 1\n", { filePath: "test.js" })
13
13
 
14
14
  expect(results).toBeDefined()
15
- expect(results[0].fatalErrorCount).toBe(0)
15
+ expect(results[0]?.fatalErrorCount).toBe(0)
16
16
  })
17
17
  })
@@ -1,5 +1,17 @@
1
- import nextPlugin from "../plugins/next.js"
1
+ import { next as nextPlugin } from "../plugins/next.js"
2
2
 
3
- const nextConfig = [nextPlugin]
3
+ export const nextConfig = [nextPlugin]
4
4
 
5
- export default nextConfig
5
+ /**
6
+ * Next.js framework configuration
7
+ *
8
+ * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
9
+ * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
10
+ */
11
+ export function next(config) {
12
+ return {
13
+ extends: [...nextConfig, ...(config?.extends ?? [])],
14
+ files: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
15
+ ...config,
16
+ }
17
+ }
@@ -1,9 +1,9 @@
1
1
  import { ESLint } from "eslint"
2
2
 
3
- import config from "./next.js"
3
+ import { nextConfig } from "./next.js"
4
4
 
5
5
  const eslint = new ESLint({
6
- overrideConfig: config,
6
+ overrideConfig: nextConfig,
7
7
  overrideConfigFile: true,
8
8
  })
9
9
 
@@ -12,6 +12,6 @@ describe("next", () => {
12
12
  const results = await eslint.lintText("const x = 1\n", { filePath: "test.tsx" })
13
13
 
14
14
  expect(results).toBeDefined()
15
- expect(results[0].fatalErrorCount).toBe(0)
15
+ expect(results[0]?.fatalErrorCount).toBe(0)
16
16
  })
17
17
  })
@@ -1,6 +1,18 @@
1
- import nPlugin from "../plugins/n.js"
2
- import securityNodePlugin from "../plugins/security-node.js"
1
+ import { nodeN } from "../plugins/n.js"
2
+ import { securityNode } from "../plugins/security-node.js"
3
3
 
4
- const nodeConfig = [nPlugin, securityNodePlugin]
4
+ export const nodeConfig = [nodeN, securityNode]
5
5
 
6
- export default nodeConfig
6
+ /**
7
+ * Node.js ESLint configuration
8
+ *
9
+ * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
10
+ * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
11
+ */
12
+ export function node(config) {
13
+ return {
14
+ extends: [...nodeConfig, ...(config?.extends ?? [])],
15
+ files: ["**/*.js", "**/*.cjs", "**/*.mjs", "**/*.ts", "**/*.cts", "**/*.mts"],
16
+ ...config,
17
+ }
18
+ }
@@ -1,9 +1,9 @@
1
1
  import { ESLint } from "eslint"
2
2
 
3
- import config from "./node.js"
3
+ import { nodeConfig } from "./node.js"
4
4
 
5
5
  const eslint = new ESLint({
6
- overrideConfig: config,
6
+ overrideConfig: nodeConfig,
7
7
  overrideConfigFile: true,
8
8
  })
9
9
 
@@ -12,6 +12,6 @@ describe("node", () => {
12
12
  const results = await eslint.lintText("const x = 1\n", { filePath: "test.js" })
13
13
 
14
14
  expect(results).toBeDefined()
15
- expect(results[0].fatalErrorCount).toBe(0)
15
+ expect(results[0]?.fatalErrorCount).toBe(0)
16
16
  })
17
17
  })