@storm-software/linting-tools 1.32.5 → 1.33.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/jest.config.ts +11 -0
  3. package/package.json +1 -1
  4. package/project.json +96 -0
  5. package/src/alex/index.ts +82 -0
  6. package/src/cli/index.ts +289 -0
  7. package/src/eslint/{json/index.js → constants.ts} +39 -52
  8. package/src/eslint/graphql/{index.js → index.ts} +4 -12
  9. package/src/eslint/index.ts +7 -0
  10. package/src/eslint/javascript/index.ts +22 -0
  11. package/src/eslint/jest/index.ts +16 -0
  12. package/src/eslint/json/index.ts +37 -0
  13. package/src/eslint/next/index.ts +25 -0
  14. package/src/eslint/react/index.ts +25 -0
  15. package/src/eslint/rules/import.ts +88 -0
  16. package/src/eslint/rules/jsx-a11y.ts +8 -0
  17. package/src/eslint/{react/index.js → rules/react.ts} +3 -44
  18. package/src/eslint/{javascript/index.js → rules/storm.ts} +3 -144
  19. package/src/eslint/rules/ts-docs.ts +12 -0
  20. package/src/eslint/rules/unicorn.ts +23 -0
  21. package/src/eslint/typescript/index.ts +144 -0
  22. package/src/manypkg/index.ts +179 -0
  23. package/{tsconfig → src/tsconfig}/tsconfig.root.json +13 -5
  24. package/tsconfig.json +24 -0
  25. package/tsconfig.lib.json +11 -0
  26. package/tsconfig.spec.json +13 -0
  27. package/LICENSE +0 -201
  28. package/bin/lint.js +0 -327125
  29. package/src/cli/index.js +0 -326744
  30. package/src/eslint/jest/index.js +0 -24
  31. package/src/eslint/next/index.js +0 -95
  32. package/src/eslint/typescript/index.js +0 -577
  33. package/src/manypkg/index.js +0 -30474
  34. /package/{alex → src/alex}/.alexignore +0 -0
  35. /package/{alex → src/alex}/.alexrc +0 -0
  36. /package/{biome → src/biome}/biome.json +0 -0
  37. /package/{cspell → src/cspell}/config.json +0 -0
  38. /package/{cspell → src/cspell}/dictionary.txt +0 -0
  39. /package/{prettier → src/prettier}/.prettierignore +0 -0
  40. /package/{prettier → src/prettier}/config.json +0 -0
  41. /package/{tsconfig → src/tsconfig}/reset.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+
2
+
3
+ ## 1.33.0 (2024-01-26)
4
+
5
+
6
+ ### 🚀 Features
7
+
8
+ - **workspace-tools:** Added custom `npm-publish` executor ([3e6292dd](https://github.com/storm-software/storm-ops/commit/3e6292dd))
9
+
10
+
11
+ ### ❤️ Thank You
12
+
13
+ - Patrick Sullivan
14
+
1
15
  ## 1.32.5 (2024-01-26)
2
16
 
3
17
 
package/jest.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ export default {
3
+ displayName: "linting-tools",
4
+ preset: "../../jest.preset.js",
5
+ testEnvironment: "node",
6
+ transform: {
7
+ "^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }]
8
+ },
9
+ moduleFileExtensions: ["ts", "js", "html"],
10
+ coverageDirectory: "../../coverage/packages/linting-tools"
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/linting-tools",
3
- "version": "1.32.5",
3
+ "version": "1.33.1",
4
4
  "private": false,
5
5
  "description": "⚡ A package containing various linting tools used to validate syntax, enforce design standards, and format code in a Storm workspace.",
6
6
  "keywords": [
package/project.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "linting-tools",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/linting-tools/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "build": {
8
+ "executor": "@nx/esbuild:esbuild",
9
+ "outputs": ["{options.outputPath}"],
10
+ "options": {
11
+ "outputPath": "dist/packages/linting-tools",
12
+ "tsConfig": "packages/linting-tools/tsconfig.json",
13
+ "project": "packages/linting-tools/package.json",
14
+ "main": "packages/linting-tools/src/cli/index.ts",
15
+ "additionalEntryPoints": [
16
+ "packages/linting-tools/bin/lint.ts",
17
+ "packages/linting-tools/src/eslint/graphql/index.ts",
18
+ "packages/linting-tools/src/eslint/javascript/index.ts",
19
+ "packages/linting-tools/src/eslint/json/index.ts",
20
+ "packages/linting-tools/src/eslint/jest/index.ts",
21
+ "packages/linting-tools/src/eslint/next/index.ts",
22
+ "packages/linting-tools/src/eslint/react/index.ts",
23
+ "packages/linting-tools/src/eslint/typescript/index.ts",
24
+ "packages/linting-tools/src/manypkg/index.ts"
25
+ ],
26
+ "deleteOutputPath": true,
27
+ "bundle": true,
28
+ "sourcemap": false,
29
+ "minify": false,
30
+ "skipTypeCheck": false,
31
+ "thirdParty": true,
32
+ "format": ["esm"],
33
+ "esbuildOptions": {
34
+ "banner": {
35
+ "js": "import { fileURLToPath as _fileURLToPath } from 'url';\nimport _path from 'node:path';\nimport { createRequire as topLevelCreateRequire } from 'module';\nconst require = topLevelCreateRequire(import.meta.url);\nconst __filename = _fileURLToPath(import.meta.url);\nconst __dirname = _path.dirname(__filename);"
36
+ }
37
+ },
38
+ "assets": [
39
+ {
40
+ "input": "packages/linting-tools",
41
+ "glob": "README.md",
42
+ "output": "/"
43
+ },
44
+ {
45
+ "input": "packages/linting-tools",
46
+ "glob": "CHANGELOG.md",
47
+ "output": "/"
48
+ },
49
+ {
50
+ "input": "",
51
+ "glob": "LICENSE",
52
+ "output": "/"
53
+ },
54
+ {
55
+ "input": "packages/linting-tools",
56
+ "glob": "bin/**/*",
57
+ "output": "."
58
+ },
59
+ {
60
+ "input": "packages/linting-tools/src",
61
+ "glob": "alex/**/.{alexrc,alexignore}",
62
+ "output": "."
63
+ },
64
+ {
65
+ "input": "packages/linting-tools/src",
66
+ "glob": "biome/biome.json",
67
+ "output": "."
68
+ },
69
+ {
70
+ "input": "packages/linting-tools/src",
71
+ "glob": "cspell/**/dictionary.txt",
72
+ "output": "."
73
+ },
74
+ {
75
+ "input": "packages/linting-tools/src",
76
+ "glob": "cspell/**/*.json",
77
+ "output": "."
78
+ },
79
+ {
80
+ "input": "packages/linting-tools/src",
81
+ "glob": "prettier/**/*.*",
82
+ "output": "."
83
+ },
84
+ {
85
+ "input": "packages/linting-tools/src",
86
+ "glob": "tsconfig/**/*.*",
87
+ "output": "."
88
+ }
89
+ ]
90
+ }
91
+ },
92
+ "lint": {},
93
+ "test": {}
94
+ },
95
+ "tags": ["type:util", "scope:tools"]
96
+ }
@@ -0,0 +1,82 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { filter } from "alex/filter";
3
+ import retextEnglish from "retext-english";
4
+ import retextEquality from "retext-equality";
5
+ import retextProfanities from "retext-profanities";
6
+ import supportsColor from "supports-color";
7
+ import { PluggableList, unified } from "unified";
8
+ import { engine } from "unified-engine";
9
+ import vfileReporter from "vfile-reporter";
10
+
11
+ Error.stackTraceLimit = Infinity;
12
+
13
+ export const runAlex = (
14
+ rcName = "@storm-software/linting-tools/alex/.alexrc",
15
+ ignoreName = "@storm-software/linting-tools/alex/.alexignore"
16
+ ) => {
17
+ return new Promise(
18
+ (resolve: (value: unknown) => void, reject: (reason?: any) => void) =>
19
+ engine(
20
+ {
21
+ processor: unified(),
22
+ files: ["**/*.{txt,js,jsx,ts,tsx,md,mdx,json}"],
23
+ extensions: [
24
+ "txt",
25
+ "text",
26
+ "md",
27
+ "markdown",
28
+ "mkd",
29
+ "mkdn",
30
+ "mkdown",
31
+ "ron"
32
+ ],
33
+ configTransform: transform,
34
+ out: false,
35
+ output: false,
36
+ rcName,
37
+ rcPath: undefined,
38
+ packageField: "alex",
39
+ color: Boolean(supportsColor.stderr),
40
+ reporter: vfileReporter,
41
+ reporterOptions: {
42
+ verbose: false
43
+ },
44
+ quiet: true,
45
+ ignoreName,
46
+ ignorePatterns: [
47
+ "**/CODE_OF_CONDUCT.md",
48
+ "**/dist/**",
49
+ "**/node_modules/**"
50
+ ],
51
+ silent: false,
52
+ silentlyIgnore: true,
53
+ frail: true,
54
+ defaultConfig: transform({})
55
+ },
56
+ (error, code) => {
57
+ if (error) {
58
+ console.error(error.message);
59
+ return reject(code);
60
+ }
61
+ return resolve(code);
62
+ }
63
+ )
64
+ );
65
+ };
66
+
67
+ const transform = (options: any) => {
68
+ return {
69
+ plugins: [
70
+ retextEnglish,
71
+ [retextProfanities, { sureness: options.profanitySureness }],
72
+ [retextEquality, { noBinary: options.noBinary }],
73
+ [
74
+ filter,
75
+ {
76
+ allow: options.allow,
77
+ deny: options.deny
78
+ }
79
+ ]
80
+ ] as PluggableList
81
+ };
82
+ };
@@ -0,0 +1,289 @@
1
+ import {
2
+ type StormConfig,
3
+ findWorkspaceRootSafe,
4
+ writeDebug,
5
+ writeError,
6
+ writeFatal,
7
+ writeInfo,
8
+ writeSuccess,
9
+ writeTrace
10
+ } from "@storm-software/config-tools";
11
+ import { Command, Option } from "commander";
12
+ import { lint } from "cspell";
13
+ import { parseCircular, parseDependencyTree, prettyCircular } from "dpdm";
14
+ import { runAlex } from "../alex";
15
+ import { runManypkg } from "../manypkg";
16
+ export { findWorkspaceRootSafe } from "@storm-software/config-tools";
17
+
18
+ let _config: Partial<StormConfig> = {};
19
+
20
+ export function createProgram(config: StormConfig) {
21
+ try {
22
+ _config = config;
23
+ writeInfo(config, "⚡ Running Storm Linting Tools");
24
+
25
+ const root = findWorkspaceRootSafe();
26
+ process.env.STORM_WORKSPACE_ROOT ??= root;
27
+ process.env.NX_WORKSPACE_ROOT_PATH ??= root;
28
+ root && process.chdir(root);
29
+
30
+ const program = new Command("storm-lint");
31
+ program.version("1.0.0", "-v --version", "display CLI version");
32
+
33
+ program
34
+ .description("⚡ Lint the Storm Workspace")
35
+ .showHelpAfterError()
36
+ .showSuggestionAfterError();
37
+
38
+ const cspellConfig = new Option("--cspell-config <file>", "CSpell config file path").default(
39
+ "@storm-software/linting-tools/cspell/config.js"
40
+ );
41
+
42
+ program
43
+ .command("cspell")
44
+ .description("Run spell-check lint for the workspace.")
45
+ .addOption(cspellConfig)
46
+ .action(cspellAction);
47
+
48
+ const alexConfig = new Option("--alex-config <file>", "Alex.js config file path").default(
49
+ "@storm-software/linting-tools/alex/.alexrc"
50
+ );
51
+
52
+ const alexIgnore = new Option("--alex-ignore <file>", "Alex.js Ignore file path").default(
53
+ "@storm-software/linting-tools/alex/.alexignore"
54
+ );
55
+
56
+ program
57
+ .command("alex")
58
+ .description("Run spell-check lint for the workspace.")
59
+ .addOption(alexConfig)
60
+ .addOption(alexIgnore)
61
+ .action(alexAction);
62
+
63
+ program
64
+ .command("deps-version")
65
+ .description("Run dependency version consistency lint for the workspace.")
66
+ .action(depsVersionAction);
67
+
68
+ program
69
+ .command("circular-deps")
70
+ .description("Run circular dependency lint for the workspace.")
71
+ .action(circularDepsAction);
72
+
73
+ const manypkgType = new Option("--manypkg-type <type>", "The manypkg command to run").default(
74
+ "check"
75
+ );
76
+
77
+ const manypkgArgs = new Option(
78
+ "--manypkg-args <args>",
79
+ "The args provided to the manypkg command"
80
+ ).default([]);
81
+
82
+ const manypkgFix = new Option(
83
+ "--manypkg-fix <args>",
84
+ "The args provided to the manypkg command"
85
+ ).default(true);
86
+
87
+ program
88
+ .command("manypkg")
89
+ .description("Run package lint with Manypkg for the workspace.")
90
+ .addOption(manypkgType)
91
+ .addOption(manypkgArgs)
92
+ .addOption(manypkgFix)
93
+ .action(manypkgAction);
94
+
95
+ const cspellSkip = new Option("--skip-cspell", "Should skip CSpell linting");
96
+
97
+ const alexSkip = new Option("--skip-alex", "Should skip Alex language linting");
98
+
99
+ const depsVersionSkip = new Option(
100
+ "--skip-deps-version",
101
+ "Should skip dependency version consistency linting"
102
+ );
103
+
104
+ const circularDepsSkip = new Option(
105
+ "--skip-circular-deps",
106
+ "Should skip circular dependency linting"
107
+ );
108
+
109
+ const manypkgSkip = new Option("--skip-manypkg", "Should skip Manypkg linting");
110
+
111
+ program
112
+ .command("all")
113
+ .description("Run all linters for the workspace.")
114
+ .addOption(cspellSkip)
115
+ .addOption(alexSkip)
116
+ .addOption(depsVersionSkip)
117
+ .addOption(circularDepsSkip)
118
+ .addOption(manypkgSkip)
119
+ .addOption(cspellConfig)
120
+ .addOption(alexConfig)
121
+ .addOption(alexIgnore)
122
+ .addOption(manypkgType)
123
+ .addOption(manypkgArgs)
124
+ .addOption(manypkgFix)
125
+ .action(allAction);
126
+
127
+ return program;
128
+ } catch (e) {
129
+ writeFatal(config, `A fatal error occurred while running the program: ${e.message}`);
130
+ process.exit(1);
131
+ }
132
+ }
133
+
134
+ async function allAction(
135
+ cspellSkip: boolean,
136
+ alexSkip: boolean,
137
+ depsVersionSkip: boolean,
138
+ circularDepsSkip: boolean,
139
+ manypkgSkip: boolean,
140
+ cspellConfig: string,
141
+ alexConfig: string,
142
+ alexIgnore: string,
143
+ manypkgType: string,
144
+ manypkgArgs: string[],
145
+ manypkgFix: boolean
146
+ ) {
147
+ try {
148
+ writeInfo(_config, "⚡ Linting the Storm Workspace");
149
+
150
+ const promises = [];
151
+ if (!cspellSkip) {
152
+ promises.push(cspellAction(cspellConfig));
153
+ }
154
+
155
+ if (!alexSkip) {
156
+ promises.push(alexAction(alexConfig, alexIgnore));
157
+ }
158
+
159
+ if (!depsVersionSkip) {
160
+ promises.push(depsVersionAction());
161
+ }
162
+
163
+ if (!circularDepsSkip) {
164
+ promises.push(circularDepsAction());
165
+ }
166
+
167
+ if (!manypkgSkip) {
168
+ promises.push(manypkgAction(manypkgType, manypkgArgs, manypkgFix));
169
+ }
170
+
171
+ await Promise.all(promises);
172
+ writeSuccess(_config, "Successfully linted the workspace ✅");
173
+ } catch (e) {
174
+ writeFatal(_config, `A fatal error occurred while linting the workspace: ${e.message}`);
175
+ process.exit(1);
176
+ }
177
+ }
178
+
179
+ async function cspellAction(cspellConfig: string) {
180
+ try {
181
+ console.log("⚡Linting the workspace spelling");
182
+ const result = await lint(["**/*.{txt,js,jsx,ts,tsx,md,mdx}"], {
183
+ cache: true,
184
+ summary: true,
185
+ issues: true,
186
+ progress: false,
187
+ relative: true,
188
+ dot: true,
189
+ debug: true,
190
+ gitignore: true,
191
+ root: process.env.STORM_WORKSPACE_ROOT ? process.env.STORM_WORKSPACE_ROOT : process.cwd(),
192
+ defaultConfiguration: false,
193
+ config: cspellConfig
194
+ });
195
+ if (result.errors) {
196
+ writeError(_config, "Spelling linting has failed ❌");
197
+ process.exit(1);
198
+ }
199
+
200
+ writeSuccess(_config, "Spelling linting is complete ✅");
201
+ } catch (e) {
202
+ console.error(e);
203
+ process.exit(1);
204
+ }
205
+ }
206
+
207
+ async function alexAction(alexConfig: string, alexIgnore: string) {
208
+ try {
209
+ writeInfo(_config, "⚡ Linting the workspace language with alexjs.com");
210
+
211
+ if (await runAlex(alexConfig, alexIgnore)) {
212
+ writeError(_config, "Language linting has failed ❌");
213
+ process.exit(1);
214
+ }
215
+
216
+ writeSuccess(_config, "Language linting is complete ✅");
217
+ } catch (e) {
218
+ writeFatal(
219
+ _config,
220
+ `A fatal error occurred while language linting the workspace: ${e.message}`
221
+ );
222
+ process.exit(1);
223
+ }
224
+ }
225
+
226
+ async function depsVersionAction() {
227
+ try {
228
+ writeInfo(_config, "⚡ Linting the workspace dependency version consistency");
229
+
230
+ const { CDVC } = await import("check-dependency-version-consistency");
231
+ const cdvc = new CDVC(".", { fix: true });
232
+
233
+ // Show output for dependencies we fixed.
234
+ if (cdvc.hasMismatchingDependenciesFixable) {
235
+ writeDebug(_config, cdvc.toFixedSummary());
236
+ }
237
+
238
+ // Show output for dependencies that still have mismatches.
239
+ if (cdvc.hasMismatchingDependenciesNotFixable) {
240
+ writeError(_config, "Dependency version consistency linting has failed ❌");
241
+ writeError(_config, cdvc.toMismatchSummary());
242
+ process.exit(1);
243
+ }
244
+
245
+ writeSuccess(_config, "Dependency Version linting is complete ✅");
246
+ } catch (e) {
247
+ writeFatal(
248
+ _config,
249
+ `A fatal error occurred while dependency Version linting the workspace: ${e.message}`
250
+ );
251
+ process.exit(1);
252
+ }
253
+ }
254
+
255
+ async function circularDepsAction() {
256
+ try {
257
+ writeInfo(_config, "⚡ Linting the workspace circular dependency");
258
+
259
+ const tree = await parseDependencyTree("**/*.*", {
260
+ tsconfig: "./tsconfig.base.json",
261
+ transform: true,
262
+ skipDynamicImports: false
263
+ });
264
+
265
+ const circulars = parseCircular(tree);
266
+ writeTrace(_config, prettyCircular(circulars));
267
+
268
+ writeSuccess(_config, "Circular dependency linting is complete ✅");
269
+ } catch (e) {
270
+ writeFatal(
271
+ _config,
272
+ `A fatal error occurred while circular dependency linting the workspace: ${e.message}`
273
+ );
274
+ process.exit(1);
275
+ }
276
+ }
277
+
278
+ async function manypkgAction(manypkgType = "check", manypkgArgs: string[], manypkgFix: boolean) {
279
+ try {
280
+ writeInfo(_config, "⚡ Linting the workspace's packages with Manypkg");
281
+
282
+ await runManypkg(manypkgType, manypkgArgs, manypkgFix);
283
+
284
+ writeSuccess(_config, "Manypkg linting is complete ✅");
285
+ } catch (e) {
286
+ writeFatal(_config, `A fatal error occurred while manypkg linting the workspace: ${e.message}`);
287
+ process.exit(1);
288
+ }
289
+ }
@@ -1,12 +1,4 @@
1
- import { fileURLToPath as _fileURLToPath } from 'url';
2
- import _path from 'node:path';
3
- import { createRequire as topLevelCreateRequire } from 'module';
4
- const require = topLevelCreateRequire(import.meta.url);
5
- const __filename = _fileURLToPath(import.meta.url);
6
- const __dirname = _path.dirname(__filename);
7
-
8
- // packages/linting-tools/src/eslint/constants.ts
9
- var RESTRICTED_SYNTAX = [
1
+ export const RESTRICTED_SYNTAX = [
10
2
  {
11
3
  // ❌ readFile(…, { encoding: … })
12
4
  selector: `CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]`,
@@ -34,12 +26,15 @@ var RESTRICTED_SYNTAX = [
34
26
  },
35
27
  {
36
28
  // ❌ Boolean(…)
37
- selector: "CallExpression[callee.name=Boolean][arguments.1.elements.length!=0]",
38
- message: "Prefer `!!\u2026` over `Boolean(\u2026)` because TypeScript infers a narrow literal boolean `type: true` instead of `type: boolean`."
29
+ selector:
30
+ "CallExpression[callee.name=Boolean][arguments.1.elements.length!=0]",
31
+ message:
32
+ "Prefer `!!…` over `Boolean(…)` because TypeScript infers a narrow literal boolean `type: true` instead of `type: boolean`."
39
33
  },
40
34
  {
41
35
  // ❌ process.browser
42
- selector: "ExpressionStatement[expression.object.name=process][expression.property.name=browser]",
36
+ selector:
37
+ "ExpressionStatement[expression.object.name=process][expression.property.name=browser]",
43
38
  message: "`process.browser` is deprecated, use `!!globalThis.window`"
44
39
  }
45
40
  // {
@@ -51,50 +46,42 @@ var RESTRICTED_SYNTAX = [
51
46
  // message: 'Do not use nested destructuring.',
52
47
  // },
53
48
  ];
54
- var REACT_RESTRICTED_SYNTAX = [
49
+
50
+ export const REACT_RESTRICTED_SYNTAX = [
55
51
  ...RESTRICTED_SYNTAX,
56
52
  {
57
53
  // ❌ useMemo(…, [])
58
- selector: "CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]",
59
- message: "`useMemo` with an empty dependency array can't provide a stable reference, use `useRef` instead."
54
+ selector:
55
+ "CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]",
56
+ message:
57
+ "`useMemo` with an empty dependency array can't provide a stable reference, use `useRef` instead."
60
58
  }
61
59
  ];
62
- var CODE_BLOCK = "**/*.md{,x}/*";
63
60
 
64
- // packages/linting-tools/src/eslint/json/index.ts
65
- var JSONC_FILES = [
66
- "tsconfig.json",
67
- "tsconfig.base.json",
68
- "nx.json",
69
- ".vscode/launch.json"
61
+ export const RESTRICTED_GLOBALS = [
62
+ "stop",
63
+ { name: "isNaN", message: "Use Number.isNaN instead" }
64
+ ];
65
+
66
+ export const RESTRICTED_MODULES = [
67
+ { name: "axios", message: "Use `fetch/node-fetch` instead." },
68
+ { name: "moment", message: "Use `dayjs/date-fns` instead." },
69
+ { name: "classnames", message: "Use `clsx` instead because it is faster." },
70
+ {
71
+ name: "lodash/isString.js",
72
+ message: "Use `typeof yourVar === 'string'` instead."
73
+ },
74
+ { name: "lodash/isArray.js", message: "Use `Array.isArray` instead." },
75
+ { name: "lodash/flatten.js", message: "Use `Array#flat()` instead." },
76
+ {
77
+ name: "lodash/compact.js",
78
+ message: "Use `Array#filter(Boolean)` instead."
79
+ },
80
+ { name: "lodash/identity.js", message: "Use `(value) => value` instead." }
70
81
  ];
71
- var config = {
72
- root: true,
73
- overrides: [
74
- {
75
- files: "*.json",
76
- excludedFiles: JSONC_FILES,
77
- extends: "plugin:jsonc/recommended-with-json"
78
- },
79
- {
80
- files: ["*.jsonc", ...JSONC_FILES],
81
- extends: "plugin:jsonc/recommended-with-jsonc"
82
- },
83
- {
84
- files: "*.json5",
85
- extends: "plugin:jsonc/recommended-with-json5"
86
- },
87
- {
88
- files: "*.json{,c,5}",
89
- excludedFiles: CODE_BLOCK,
90
- plugins: ["unicorn"],
91
- rules: {
92
- "unicorn/filename-case": "error"
93
- }
94
- }
95
- ]
96
- };
97
- var json_default = config;
98
- export {
99
- json_default as default
100
- };
82
+
83
+ export const JS_FILES = ["*.js?(x)", "*.mjs"];
84
+
85
+ export const CODE_BLOCK = "**/*.md{,x}/*";
86
+ export const CODE_FILE = "*.{,c,m}{j,t}s{,x}";
87
+ export const TS_FILE = "*.{,c,m}ts{,x}";
@@ -1,12 +1,6 @@
1
- import { fileURLToPath as _fileURLToPath } from 'url';
2
- import _path from 'node:path';
3
- import { createRequire as topLevelCreateRequire } from 'module';
4
- const require = topLevelCreateRequire(import.meta.url);
5
- const __filename = _fileURLToPath(import.meta.url);
6
- const __dirname = _path.dirname(__filename);
1
+ import { Linter } from "eslint";
7
2
 
8
- // packages/linting-tools/src/eslint/graphql/index.ts
9
- var config = {
3
+ const config: Linter.Config = {
10
4
  root: true,
11
5
  overrides: [
12
6
  {
@@ -127,7 +121,5 @@ var config = {
127
121
  }
128
122
  ]
129
123
  };
130
- var graphql_default = config;
131
- export {
132
- graphql_default as default
133
- };
124
+
125
+ export default config;
@@ -0,0 +1,7 @@
1
+ export * from "./graphql";
2
+ export * from "./javascript";
3
+ export * from "./jest";
4
+ export * from "./json";
5
+ export * from "./next";
6
+ export * from "./react";
7
+ export * from "./typescript";
@@ -0,0 +1,22 @@
1
+ import { Linter } from "eslint";
2
+ import importRules from "../rules/import";
3
+ import stormRules from "../rules/storm";
4
+ import unicornRules from "../rules/unicorn";
5
+
6
+ const config: Linter.Config = {
7
+ root: true,
8
+ overrides: [
9
+ {
10
+ files: ["*.js", "*.jsx"],
11
+ extends: ["plugin:@nx/javascript"],
12
+ plugins: ["unicorn", "import"],
13
+ rules: {
14
+ ...importRules,
15
+ ...unicornRules,
16
+ ...stormRules
17
+ }
18
+ }
19
+ ]
20
+ };
21
+
22
+ export default config;