@storm-software/linting-tools 1.30.0 → 1.30.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +5 -2
  3. package/jest.config.ts +11 -0
  4. package/package.json +2 -2
  5. package/project.json +96 -0
  6. package/src/alex/index.ts +82 -0
  7. package/src/cli/index.ts +289 -0
  8. package/src/eslint/{json/index.js → constants.ts} +39 -52
  9. package/src/eslint/graphql/{index.js → index.ts} +4 -12
  10. package/src/eslint/index.ts +7 -0
  11. package/src/eslint/javascript/index.ts +22 -0
  12. package/src/eslint/jest/index.ts +16 -0
  13. package/src/eslint/json/index.ts +37 -0
  14. package/src/eslint/next/index.ts +25 -0
  15. package/src/eslint/react/index.ts +25 -0
  16. package/src/eslint/rules/import.ts +88 -0
  17. package/src/eslint/rules/jsx-a11y.ts +8 -0
  18. package/src/eslint/{react/index.js → rules/react.ts} +3 -44
  19. package/src/eslint/{javascript/index.js → rules/storm.ts} +3 -144
  20. package/src/eslint/rules/ts-docs.ts +12 -0
  21. package/src/eslint/rules/unicorn.ts +23 -0
  22. package/src/eslint/typescript/index.ts +144 -0
  23. package/src/manypkg/index.ts +179 -0
  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 -327122
  29. package/src/cli/index.js +0 -326741
  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
  42. /package/{tsconfig → src/tsconfig}/tsconfig.root.json +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ ## 1.30.2 (2024-01-21)
2
+
3
+
4
+ ### 🩹 Fixes
5
+
6
+ - **git-tools:** Clean up of various unused dependencies ([c39257b8](https://github.com/storm-software/storm-ops/commit/c39257b8))
7
+
8
+ - **git-tools:** Remove the git extension from the repository URL ([50a6de3d](https://github.com/storm-software/storm-ops/commit/50a6de3d))
9
+
10
+
11
+ ### ❤️ Thank You
12
+
13
+ - Patrick Sullivan
14
+
15
+ ## 1.30.1 (2024-01-21)
16
+
17
+
18
+ ### 🩹 Fixes
19
+
20
+ - **git-tools:** Clean up of various unused dependencies ([c39257b8](https://github.com/storm-software/storm-ops/commit/c39257b8))
21
+
22
+ - **git-tools:** Remove the git extension from the repository URL ([50a6de3d](https://github.com/storm-software/storm-ops/commit/50a6de3d))
23
+
24
+
25
+ ### ❤️ Thank You
26
+
27
+ - Patrick Sullivan
28
+
29
+ # [1.30.0](https://github.com/storm-software/storm-ops/compare/linting-tools-v1.29.0...linting-tools-v1.30.0) (2024-01-20)
30
+
31
+
32
+ ### Features
33
+
34
+ * **workspace-tools:** Added the `skipNativeModulesPlugin` option to tsup build ([eb5ade8](https://github.com/storm-software/storm-ops/commit/eb5ade8320372a792c9ca97fa9f843e63f2601d1))
35
+
1
36
  # [1.29.0](https://github.com/storm-software/storm-ops/compare/linting-tools-v1.28.1...linting-tools-v1.29.0) (2024-01-19)
2
37
 
3
38
 
package/README.md CHANGED
@@ -16,10 +16,13 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
16
16
 
17
17
  <h3 align="center">💻 Visit <a href="https://stormsoftware.org" target="_blank">stormsoftware.org</a> to stay up to date with this developer</h3><br />
18
18
 
19
- [![Version](https://img.shields.io/badge/version-1.27.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
19
+ [![Version](https://img.shields.io/badge/version-1.30.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
20
20
  [![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with docusaurus](https://img.shields.io/badge/documented_with-docusaurus-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://docusaurus.io/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
21
21
 
22
- <h3 align="center" bold="true">⚠️ <b>Attention</b> ⚠️ This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be availible through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.</h3><br />
22
+ > [!IMPORTANT]
23
+ > This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be availible through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.
24
+
25
+ <br />
23
26
 
24
27
 
25
28
  <!-- markdownlint-restore -->
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.30.0",
3
+ "version": "1.30.2",
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": [
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "repository": {
21
21
  "type": "github",
22
- "url": "https://github.com/storm-software/storm-ops.git",
22
+ "url": "https://github.com/storm-software/storm-ops",
23
23
  "directory": "packages/linting-tools"
24
24
  },
25
25
  "license": "Apache License 2.0",
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}";