@storm-software/linting-tools 1.43.0 → 1.44.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 (47) hide show
  1. package/.eslintrc.json +97 -0
  2. package/CHANGELOG.md +43 -0
  3. package/README.md +1 -1
  4. package/bin/lint.ts +24 -13
  5. package/jest.config.ts +11 -0
  6. package/package.json +10 -6
  7. package/project.json +111 -0
  8. package/src/alex/index.ts +67 -0
  9. package/{biome → src/biome}/biome.json +2 -1
  10. package/src/cli/index.ts +300 -0
  11. package/src/eslint/constants.ts +87 -0
  12. package/src/eslint/graphql/{index.js → index.ts} +4 -7
  13. package/src/eslint/index.ts +7 -0
  14. package/src/eslint/javascript/index.ts +22 -0
  15. package/src/eslint/jest/index.ts +16 -0
  16. package/src/eslint/json/index.ts +32 -0
  17. package/src/eslint/next/index.ts +25 -0
  18. package/src/eslint/react/index.ts +25 -0
  19. package/src/eslint/rules/import.ts +85 -0
  20. package/src/eslint/rules/jsx-a11y.ts +8 -0
  21. package/src/eslint/{react/index.js → rules/react.ts} +3 -39
  22. package/src/eslint/{javascript/index.js → rules/storm.ts} +3 -139
  23. package/src/eslint/rules/ts-docs.ts +12 -0
  24. package/src/eslint/rules/unicorn.ts +23 -0
  25. package/src/eslint/typescript/index.ts +132 -0
  26. package/src/ls-lint/.ls-lint.yml +13 -0
  27. package/src/manypkg/index.ts +164 -0
  28. package/src/taplo/.taplo.toml +8 -0
  29. package/tsconfig.json +18 -0
  30. package/tsconfig.script.json +21 -0
  31. package/tsconfig.spec.json +13 -0
  32. package/LICENSE +0 -201
  33. package/bin/lint.js +0 -333139
  34. package/ls-lint/.ls-lint.yml +0 -13
  35. package/src/cli/index.js +0 -328555
  36. package/src/eslint/jest/index.js +0 -19
  37. package/src/eslint/json/index.js +0 -95
  38. package/src/eslint/next/index.js +0 -90
  39. package/src/eslint/typescript/index.js +0 -569
  40. package/src/manypkg/index.js +0 -34729
  41. package/taplo/.taplo.toml +0 -6
  42. /package/{alex → src/alex}/.alexignore +0 -0
  43. /package/{alex → src/alex}/.alexrc +0 -0
  44. /package/{cspell → src/cspell}/config.json +0 -0
  45. /package/{cspell → src/cspell}/dictionary.txt +0 -0
  46. /package/{prettier → src/prettier}/.prettierignore +0 -0
  47. /package/{prettier → src/prettier}/config.json +0 -0
package/.eslintrc.json ADDED
@@ -0,0 +1,97 @@
1
+ {
2
+ "extends": ["../../.eslintrc.json", "../../.eslintrc.base.json"],
3
+ "ignorePatterns": ["!**/*", "node_modules/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
+ "rules": {}
8
+ },
9
+ {
10
+ "files": ["*.ts", "*.tsx"],
11
+ "rules": {}
12
+ },
13
+ {
14
+ "files": ["*.js", "*.jsx"],
15
+ "rules": {}
16
+ },
17
+ {
18
+ "files": ["*.json"],
19
+ "parser": "jsonc-eslint-parser",
20
+ "rules": {
21
+ "@nx/dependency-checks": [
22
+ "error",
23
+ {
24
+ "buildTargets": ["build"],
25
+ "ignoredFiles": [
26
+ "{projectRoot}/esbuild.config.{js,ts,mjs,mts}",
27
+ "{projectRoot}/jest.config.ts"
28
+ ],
29
+ "ignoredDependencies": [
30
+ "@cspell/dict-ada",
31
+ "@cspell/dict-aws",
32
+ "@cspell/dict-bash",
33
+ "@cspell/dict-companies",
34
+ "@cspell/dict-cpp",
35
+ "@cspell/dict-cryptocurrencies",
36
+ "@cspell/dict-csharp",
37
+ "@cspell/dict-css",
38
+ "@cspell/dict-dart",
39
+ "@cspell/dict-django",
40
+ "@cspell/dict-docker",
41
+ "@cspell/dict-dotnet",
42
+ "@cspell/dict-elixir",
43
+ "@cspell/dict-en_us",
44
+ "@cspell/dict-en-common-misspellings",
45
+ "@cspell/dict-en-gb",
46
+ "@cspell/dict-filetypes",
47
+ "@cspell/dict-fonts",
48
+ "@cspell/dict-fsharp",
49
+ "@cspell/dict-fullstack",
50
+ "@cspell/dict-gaming-terms",
51
+ "@cspell/dict-git",
52
+ "@cspell/dict-golang",
53
+ "@cspell/dict-haskell",
54
+ "@cspell/dict-html-symbol-entities",
55
+ "@cspell/dict-html",
56
+ "@cspell/dict-java",
57
+ "@cspell/dict-k8s",
58
+ "@cspell/dict-latex",
59
+ "@cspell/dict-lorem-ipsum",
60
+ "@cspell/dict-lua",
61
+ "@cspell/dict-makefile",
62
+ "@cspell/dict-node",
63
+ "@cspell/dict-npm",
64
+ "@cspell/dict-php",
65
+ "@cspell/dict-powershell",
66
+ "@cspell/dict-public-licenses",
67
+ "@cspell/dict-python",
68
+ "@cspell/dict-r",
69
+ "@cspell/dict-ruby",
70
+ "@cspell/dict-rust",
71
+ "@cspell/dict-scala",
72
+ "@cspell/dict-sql",
73
+ "@cspell/dict-software-terms",
74
+ "@cspell/dict-svelte",
75
+ "@cspell/dict-swift",
76
+ "@cspell/dict-typescript",
77
+ "@cspell/dict-vue",
78
+ "@size-limit/file",
79
+ "@size-limit/time",
80
+ "size-limit",
81
+ "remark-retext",
82
+ "remark-parse",
83
+ "remark-mdx",
84
+ "remark-gfm",
85
+ "remark-frontmatter",
86
+ "rehype-retext",
87
+ "rehype-parse"
88
+ ],
89
+ "checkMissingDependencies": true,
90
+ "checkObsoleteDependencies": true,
91
+ "checkVersionMismatches": false
92
+ }
93
+ ]
94
+ }
95
+ }
96
+ ]
97
+ }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,46 @@
1
+ ## 1.44.1 (2024-03-25)
2
+
3
+
4
+ ### 🩹 Fixes
5
+
6
+ - **storm-workspace:** Resolved issue with failed unit-test ([42e5a411](https://github.com/storm-software/storm-ops/commit/42e5a411))
7
+
8
+
9
+ ### ❤️ Thank You
10
+
11
+ - Patrick Sullivan
12
+
13
+ ## 1.44.0 (2024-03-25)
14
+
15
+
16
+ ### 🚀 Features
17
+
18
+ - **workspace-tools:** Added Nx plugin to apply rust and typescript targets ([5738161f](https://github.com/storm-software/storm-ops/commit/5738161f))
19
+
20
+ - **workspace-tools:** Major updates to base nx.json configuration ([06ec9a6a](https://github.com/storm-software/storm-ops/commit/06ec9a6a))
21
+
22
+
23
+ ### 🩹 Fixes
24
+
25
+ - **git-tools:** Resolved issues with `left-hook` scripts ([daf28aa2](https://github.com/storm-software/storm-ops/commit/daf28aa2))
26
+
27
+
28
+ ### ❤️ Thank You
29
+
30
+ - Patrick Sullivan
31
+
32
+ ## 1.43.1 (2024-03-19)
33
+
34
+
35
+ ### 🩹 Fixes
36
+
37
+ - **linting-tools:** Update the linting-tools asset configuration ([c35e2491](https://github.com/storm-software/storm-ops/commit/c35e2491))
38
+
39
+
40
+ ### ❤️ Thank You
41
+
42
+ - Patrick Sullivan
43
+
1
44
  ## 1.43.0 (2024-03-19)
2
45
 
3
46
 
package/README.md CHANGED
@@ -16,7 +16,7 @@ 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.42.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
19
+ [![Version](https://img.shields.io/badge/version-1.43.1-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
22
  > [!IMPORTANT]
package/bin/lint.ts CHANGED
@@ -1,25 +1,36 @@
1
- #!/usr/bin/env node
2
-
3
1
  import {
4
2
  exitWithSuccess,
5
3
  handleProcess,
6
4
  loadStormConfig,
7
- writeSuccess
5
+ writeSuccess,
6
+ writeFatal,
7
+ exitWithError
8
8
  } from "@storm-software/config-tools";
9
9
  import { createProgram } from "../src/cli";
10
+ import { register as registerTsConfigPaths } from "tsconfig-paths";
11
+ import { join } from "node:path";
12
+ import { readJsonSync } from "fs-extra";
10
13
 
11
- const handle = async () => {
14
+ void (async () => {
12
15
  const config = await loadStormConfig();
13
- handleProcess(config);
16
+ try {
17
+ handleProcess(config);
14
18
 
15
- const program = await createProgram(config);
16
- program.exitOverride();
19
+ const compilerOptions = readJsonSync(
20
+ join(config.workspaceRoot ?? "./", "tsconfig.base.json")
21
+ ).compilerOptions;
22
+ registerTsConfigPaths(compilerOptions);
17
23
 
18
- await program.parseAsync(process.argv);
24
+ const program = await createProgram(config);
25
+ program.exitOverride();
19
26
 
20
- writeSuccess(config, "Code linting and fixing completed successfully!");
21
- };
27
+ await program.parseAsync(process.argv);
22
28
 
23
- handle().then(() => {
24
- loadStormConfig().then((config) => exitWithSuccess(config));
25
- });
29
+ writeSuccess(config, "Code linting and fixing completed successfully!");
30
+ exitWithSuccess(config);
31
+ } catch (error) {
32
+ writeFatal(config, `A fatal error occurred while running the program: ${error.message}`);
33
+ exitWithError(config);
34
+ process.exit(1);
35
+ }
36
+ })();
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.43.0",
3
+ "version": "1.44.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": [
@@ -22,7 +22,7 @@
22
22
  "url": "https://github.com/storm-software/storm-ops",
23
23
  "directory": "packages/linting-tools"
24
24
  },
25
- "license": "Apache License 2.0",
25
+ "license": "Apache 2.0",
26
26
  "author": {
27
27
  "name": "Storm Software",
28
28
  "email": "contact@stormsoftware.org",
@@ -87,13 +87,12 @@
87
87
  "@size-limit/time": "11.0.2",
88
88
  "alex": "11.0.1",
89
89
  "check-dependency-version-consistency": "4.1.0",
90
- "child_process": "1.0.2",
91
90
  "commander": "11.1.0",
92
91
  "cspell": "8.3.2",
93
92
  "dpdm": "3.14.0",
94
93
  "eslint": "8.56.0",
94
+ "fs-extra": "11.2.0",
95
95
  "p-limit": "4.0.0",
96
- "prettier-plugin-tailwindcss": "0.5.11",
97
96
  "rehype-parse": "9.0.0",
98
97
  "rehype-retext": "4.0.0",
99
98
  "remark-frontmatter": "5.0.0",
@@ -106,16 +105,21 @@
106
105
  "retext-profanities": "8.0.0",
107
106
  "size-limit": "11.0.2",
108
107
  "spawndamnit": "2.0.0",
109
- "supports-color": "9.4.0",
108
+ "tsconfig-paths": "^4.2.0",
110
109
  "unified": "11.0.4",
111
- "unified-diff": "5.0.0",
112
110
  "unified-engine": "11.2.0",
113
111
  "vfile-reporter": "^8.1.0"
114
112
  },
115
113
  "devDependencies": {
114
+ "@storm-software/config": "1.7.0",
115
+ "@storm-software/config-tools": "1.33.0",
116
116
  "@types/eslint": "8.44.6"
117
117
  },
118
118
  "publishConfig": {
119
119
  "access": "public"
120
+ },
121
+ "peerDependencies": {
122
+ "@storm-software/config": "workspace:^",
123
+ "@storm-software/config-tools": "workspace:^"
120
124
  }
121
125
  }
package/project.json ADDED
@@ -0,0 +1,111 @@
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": true,
31
+ "thirdParty": true,
32
+ "format": ["cjs", "esm"],
33
+ "external": ["nx"],
34
+ "esbuildOptions": {
35
+ "legalComments": "inline",
36
+ "banner": {
37
+ "js": "const require = (await import('node:module')).createRequire(import.meta.url);const __filename = (await import('node:url')).fileURLToPath(import.meta.url);const __dirname = (await import('node:path')).dirname(__filename);"
38
+ }
39
+ },
40
+ "assets": [
41
+ {
42
+ "input": "packages/linting-tools",
43
+ "glob": "README.md",
44
+ "output": "."
45
+ },
46
+ {
47
+ "input": "packages/linting-tools",
48
+ "glob": "CHANGELOG.md",
49
+ "output": "."
50
+ },
51
+ {
52
+ "input": "",
53
+ "glob": "LICENSE",
54
+ "output": "."
55
+ },
56
+ {
57
+ "input": "packages/linting-tools",
58
+ "glob": "bin/**/*",
59
+ "output": "."
60
+ },
61
+ {
62
+ "input": "packages/linting-tools/src",
63
+ "glob": "alex/**/.{alexrc,alexignore}",
64
+ "output": "."
65
+ },
66
+ {
67
+ "input": "packages/linting-tools/src",
68
+ "glob": "biome/biome.json",
69
+ "output": "."
70
+ },
71
+ {
72
+ "input": "packages/linting-tools/src",
73
+ "glob": "taplo/*",
74
+ "output": "."
75
+ },
76
+ {
77
+ "input": "packages/linting-tools/src",
78
+ "glob": "ls-lint/*",
79
+ "output": "."
80
+ },
81
+ {
82
+ "input": "packages/linting-tools/src",
83
+ "glob": "cspell/**/dictionary.txt",
84
+ "output": "."
85
+ },
86
+ {
87
+ "input": "packages/linting-tools/src",
88
+ "glob": "cspell/**/*.json",
89
+ "output": "."
90
+ },
91
+ {
92
+ "input": "packages/linting-tools/node_modules",
93
+ "glob": "@cspell/**/cspell-ext.json",
94
+ "output": "cspell"
95
+ },
96
+ {
97
+ "input": "packages/linting-tools/src",
98
+ "glob": "prettier/**/*.*",
99
+ "output": "."
100
+ },
101
+ {
102
+ "input": "packages/linting-tools/src",
103
+ "glob": "tsconfig/**/*.*",
104
+ "output": "."
105
+ }
106
+ ]
107
+ }
108
+ }
109
+ },
110
+ "tags": ["type:util", "scope:tools"]
111
+ }
@@ -0,0 +1,67 @@
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 { type PluggableList, unified } from "unified";
7
+ import { engine } from "unified-engine";
8
+ import vfileReporter from "vfile-reporter";
9
+
10
+ Error.stackTraceLimit = Infinity;
11
+
12
+ export const runAlex = (
13
+ rcName = "@storm-software/linting-tools/alex/.alexrc",
14
+ ignoreName = "@storm-software/linting-tools/alex/.alexignore"
15
+ ) => {
16
+ return new Promise((resolve: (value: unknown) => void, reject: (reason?: any) => void) =>
17
+ engine(
18
+ {
19
+ processor: unified(),
20
+ files: ["**/*.{txt,js,jsx,ts,tsx,md,mdx,json}"],
21
+ extensions: ["txt", "text", "md", "mdx", "markdown", "mkd", "mkdn", "mkdown", "ron"],
22
+ configTransform: transform,
23
+ out: false,
24
+ output: false,
25
+ rcName,
26
+ rcPath: undefined,
27
+ packageField: "alex",
28
+ color: true,
29
+ reporter: vfileReporter,
30
+ reporterOptions: {
31
+ verbose: false
32
+ },
33
+ quiet: true,
34
+ ignoreName,
35
+ ignorePatterns: ["**/CODE_OF_CONDUCT.md", "**/dist/**", "**/node_modules/**"],
36
+ silent: false,
37
+ silentlyIgnore: true,
38
+ frail: true,
39
+ defaultConfig: transform({})
40
+ },
41
+ (error, code) => {
42
+ if (error) {
43
+ console.error(error.message);
44
+ return reject(code);
45
+ }
46
+ return resolve(code);
47
+ }
48
+ )
49
+ );
50
+ };
51
+
52
+ const transform = (options: any) => {
53
+ return {
54
+ plugins: [
55
+ retextEnglish,
56
+ [retextProfanities, { sureness: options.profanitySureness }],
57
+ [retextEquality, { noBinary: options.noBinary }],
58
+ [
59
+ filter,
60
+ {
61
+ allow: options.allow,
62
+ deny: options.deny
63
+ }
64
+ ]
65
+ ] as PluggableList
66
+ };
67
+ };
@@ -31,7 +31,8 @@
31
31
  "style": {
32
32
  "useDefaultParameterLast": "off",
33
33
  "useTemplate": "warn",
34
- "noUselessElse": "warn"
34
+ "noUselessElse": "warn",
35
+ "noNonNullAssertion": "warn"
35
36
  },
36
37
  "suspicious": {
37
38
  "noAssignInExpressions": "warn",