@trackunit/eslint-plugin-trackunit 0.3.4 → 0.3.5
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/CHANGELOG.md +10 -0
- package/package.json +8 -4
- package/src/lib/config/index.d.ts +1 -1
- package/src/lib/config/plugins.d.ts +1 -2
- package/src/lib/config/plugins.js +1 -3
- package/src/lib/config/presets/react.d.ts +1 -1
- package/src/lib/config/presets/react.js +0 -1
- package/src/lib/utils/file-utils.d.ts +6 -0
- package/src/lib/utils/file-utils.js +0 -67
- package/src/lib/config/presets/public-api.d.ts +0 -147
- package/src/lib/config/presets/public-api.js +0 -62
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 0.3.5 (2026-03-05)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated css-class-variance-utilities to 1.11.53
|
|
6
|
+
- Updated react-core-contexts-test to 1.12.37
|
|
7
|
+
- Updated react-form-components to 1.14.43
|
|
8
|
+
- Updated react-components to 1.17.39
|
|
9
|
+
- Updated shared-utils to 1.13.53
|
|
10
|
+
|
|
1
11
|
## 0.3.4 (2026-03-04)
|
|
2
12
|
|
|
3
13
|
This was a version bump only for eslint-plugin-trackunit to align it with other projects, there were no code changes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/eslint-plugin-trackunit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"repository": "https://github.com/Trackunit/manager",
|
|
6
6
|
"engines": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"eslint": "^9.33.0",
|
|
11
11
|
"@nx/eslint-plugin": "22.4.4",
|
|
12
12
|
"@typescript-eslint/eslint-plugin": "8.54.0",
|
|
13
|
-
"@typescript-eslint/parser": "8.54.0",
|
|
13
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
14
14
|
"@typescript-eslint/utils": "8.54.0",
|
|
15
15
|
"eslint-config-prettier": "^10.1.8",
|
|
16
16
|
"eslint-plugin-import": "2.32.0",
|
|
@@ -19,11 +19,15 @@
|
|
|
19
19
|
"eslint-plugin-no-null": "^1.0.2",
|
|
20
20
|
"eslint-plugin-react": "7.37.5",
|
|
21
21
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
22
|
-
"eslint-plugin-storybook": "^10.2.4",
|
|
23
22
|
"eslint-plugin-testing-library": "^7.6.6",
|
|
24
23
|
"globals": "^15.13.0",
|
|
25
24
|
"typescript": "5.9.3",
|
|
26
|
-
"tslib": "^2.6.2"
|
|
25
|
+
"tslib": "^2.6.2",
|
|
26
|
+
"zod": "^3.23.8",
|
|
27
|
+
"jsonc-eslint-parser": "^2.4.0"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@typescript-eslint/parser": "^8.54.0"
|
|
27
31
|
},
|
|
28
32
|
"types": "./src/index.d.ts",
|
|
29
33
|
"main": "./src/index.js",
|
|
@@ -17,7 +17,6 @@ import * as jsdoc from "eslint-plugin-jsdoc";
|
|
|
17
17
|
import * as noNull from "eslint-plugin-no-null";
|
|
18
18
|
import * as react from "eslint-plugin-react";
|
|
19
19
|
import * as reactHooks from "eslint-plugin-react-hooks";
|
|
20
|
-
import * as storybook from "eslint-plugin-storybook";
|
|
21
20
|
import * as testingLibrary from "eslint-plugin-testing-library";
|
|
22
21
|
import * as globals from "globals";
|
|
23
22
|
import * as jsoncParser from "jsonc-eslint-parser";
|
|
@@ -87,4 +86,4 @@ export declare const localRulesPlugin: {
|
|
|
87
86
|
};
|
|
88
87
|
};
|
|
89
88
|
};
|
|
90
|
-
export { eslintConfigPrettier, globals, importPlugin, jest, jsdoc, jsoncParser, noNull, nx, react, reactHooks,
|
|
89
|
+
export { eslintConfigPrettier, globals, importPlugin, jest, jsdoc, jsoncParser, noNull, nx, react, reactHooks, testingLibrary, tsParser, typescriptEslint, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typescriptEslint = exports.tsParser = exports.testingLibrary = exports.
|
|
3
|
+
exports.typescriptEslint = exports.tsParser = exports.testingLibrary = exports.reactHooks = exports.react = exports.nx = exports.noNull = exports.jsoncParser = exports.jsdoc = exports.jest = exports.importPlugin = exports.globals = exports.eslintConfigPrettier = exports.localRulesPlugin = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
/**
|
|
6
6
|
* Shared plugin instances for ESLint flat config.
|
|
@@ -31,8 +31,6 @@ const react = tslib_1.__importStar(require("eslint-plugin-react"));
|
|
|
31
31
|
exports.react = react;
|
|
32
32
|
const reactHooks = tslib_1.__importStar(require("eslint-plugin-react-hooks"));
|
|
33
33
|
exports.reactHooks = reactHooks;
|
|
34
|
-
const storybook = tslib_1.__importStar(require("eslint-plugin-storybook"));
|
|
35
|
-
exports.storybook = storybook;
|
|
36
34
|
const testingLibrary = tslib_1.__importStar(require("eslint-plugin-testing-library"));
|
|
37
35
|
exports.testingLibrary = testingLibrary;
|
|
38
36
|
const globals = tslib_1.__importStar(require("globals"));
|
|
@@ -5,7 +5,6 @@ const react_rules_1 = require("../fragments/react-rules");
|
|
|
5
5
|
const testing_library_1 = require("../fragments/testing-library");
|
|
6
6
|
const plugins_1 = require("../plugins");
|
|
7
7
|
exports.reactPreset = [
|
|
8
|
-
...(plugins_1.storybook.configs["flat/recommended"] ?? []),
|
|
9
8
|
{
|
|
10
9
|
plugins: {
|
|
11
10
|
"@trackunit": plugins_1.localRulesPlugin,
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for working with files in ESLint rules.
|
|
3
|
+
*
|
|
4
|
+
* ## Main Functions
|
|
5
|
+
* - `findNearestFile()` - Find the nearest file by walking up the directory tree
|
|
6
|
+
*/
|
|
1
7
|
/**
|
|
2
8
|
* Find the nearest file with a given name by walking up the directory tree.
|
|
3
9
|
*
|
|
@@ -8,75 +8,8 @@ const path = tslib_1.__importStar(require("path"));
|
|
|
8
8
|
* Utility functions for working with files in ESLint rules.
|
|
9
9
|
*
|
|
10
10
|
* ## Main Functions
|
|
11
|
-
* - `isTestFile()` - Check if a file is a test file
|
|
12
|
-
* - `isStoryFile()` - Check if a file is a Storybook story file
|
|
13
|
-
* - `matchesFilePattern()` - Check if a file matches a glob pattern
|
|
14
11
|
* - `findNearestFile()` - Find the nearest file by walking up the directory tree
|
|
15
12
|
*/
|
|
16
|
-
/**
|
|
17
|
-
* Convert a glob pattern to a regular expression.
|
|
18
|
-
* Supports common glob patterns used in ESLint configurations.
|
|
19
|
-
*
|
|
20
|
-
* @param pattern - Glob pattern (e.g., "**\/*.spec.ts", "**\/*.{ts,tsx}")
|
|
21
|
-
* @returns Regular expression that matches the pattern
|
|
22
|
-
* @example
|
|
23
|
-
* globToRegex("**\/*.spec.ts") // Matches any .spec.ts file
|
|
24
|
-
* globToRegex("**\/*.{ts,tsx}") // Matches any .ts or .tsx file
|
|
25
|
-
*/
|
|
26
|
-
const globToRegex = (pattern) => {
|
|
27
|
-
// Escape special regex characters except glob special chars
|
|
28
|
-
let regexPattern = pattern
|
|
29
|
-
.replace(/\./g, "\\.") // Escape dots
|
|
30
|
-
.replace(/\*\*/g, "@@DOUBLESTAR@@") // Temporarily replace **
|
|
31
|
-
.replace(/\*/g, "[^/]*") // Single * matches anything except /
|
|
32
|
-
.replace(/@@DOUBLESTAR@@/g, ".*") // ** matches anything including /
|
|
33
|
-
.replace(/\?/g, "."); // ? matches single character
|
|
34
|
-
// Handle brace expansion: {ts,tsx} → (ts|tsx)
|
|
35
|
-
regexPattern = regexPattern.replace(/\{([^}]+)\}/g, (_, group) => {
|
|
36
|
-
return `(${group.replace(/,/g, "|")})`;
|
|
37
|
-
});
|
|
38
|
-
return new RegExp(`^${regexPattern}$`);
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Check if a file path matches a glob pattern.
|
|
42
|
-
*
|
|
43
|
-
* @param filePath - The file path to check
|
|
44
|
-
* @param pattern - Glob pattern (e.g., "**\/*.spec.ts")
|
|
45
|
-
* @returns True if the file matches the pattern
|
|
46
|
-
* @example
|
|
47
|
-
* matchesFilePattern("src/component.spec.ts", "**\/*.spec.ts") // → true
|
|
48
|
-
* matchesFilePattern("src/component.ts", "**\/*.spec.ts") // → false
|
|
49
|
-
*/
|
|
50
|
-
const matchesFilePattern = (filePath, pattern) => {
|
|
51
|
-
const regex = globToRegex(pattern);
|
|
52
|
-
return regex.test(filePath);
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Check if a file path is a test file based on naming conventions.
|
|
56
|
-
*
|
|
57
|
-
* @param filePath - The file path to check
|
|
58
|
-
* @returns True if the file is a test file
|
|
59
|
-
* @example
|
|
60
|
-
* isTestFile("src/component.spec.ts") // → true
|
|
61
|
-
* isTestFile("src/component.test.tsx") // → true
|
|
62
|
-
* isTestFile("src/component.ts") // → false
|
|
63
|
-
*/
|
|
64
|
-
const isTestFile = (filePath) => {
|
|
65
|
-
return /\.(spec|test)\.(ts|tsx|js|jsx)$/.test(filePath);
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Check if a file path is a Storybook story file.
|
|
69
|
-
*
|
|
70
|
-
* @param filePath - The file path to check
|
|
71
|
-
* @returns True if the file is a story file
|
|
72
|
-
* @example
|
|
73
|
-
* isStoryFile("src/component.stories.ts") // → true
|
|
74
|
-
* isStoryFile("src/component.stories.tsx") // → true
|
|
75
|
-
* isStoryFile("src/component.ts") // → false
|
|
76
|
-
*/
|
|
77
|
-
const isStoryFile = (filePath) => {
|
|
78
|
-
return /\.stories\.(ts|tsx|js|jsx)$/.test(filePath);
|
|
79
|
-
};
|
|
80
13
|
/**
|
|
81
14
|
* Find the nearest file with a given name by walking up the directory tree.
|
|
82
15
|
*
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { nx } from "../plugins";
|
|
2
|
-
export declare const publicApi: ({
|
|
3
|
-
plugins: {
|
|
4
|
-
"react-hooks": {
|
|
5
|
-
meta: {
|
|
6
|
-
name: string;
|
|
7
|
-
version: string;
|
|
8
|
-
};
|
|
9
|
-
rules: {
|
|
10
|
-
"exhaustive-deps": {
|
|
11
|
-
meta: {
|
|
12
|
-
type: "suggestion";
|
|
13
|
-
docs: {
|
|
14
|
-
description: string;
|
|
15
|
-
recommended: true;
|
|
16
|
-
url: string;
|
|
17
|
-
};
|
|
18
|
-
fixable: "code";
|
|
19
|
-
hasSuggestions: true;
|
|
20
|
-
schema: {
|
|
21
|
-
type: "object";
|
|
22
|
-
additionalProperties: false;
|
|
23
|
-
enableDangerousAutofixThisMayCauseInfiniteLoops: boolean;
|
|
24
|
-
properties: {
|
|
25
|
-
additionalHooks: {
|
|
26
|
-
type: "string";
|
|
27
|
-
};
|
|
28
|
-
enableDangerousAutofixThisMayCauseInfiniteLoops: {
|
|
29
|
-
type: "boolean";
|
|
30
|
-
};
|
|
31
|
-
experimental_autoDependenciesHooks: {
|
|
32
|
-
type: "array";
|
|
33
|
-
items: {
|
|
34
|
-
type: "string";
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
requireExplicitEffectDeps: {
|
|
38
|
-
type: "boolean";
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
}[];
|
|
42
|
-
};
|
|
43
|
-
create(context: import("eslint").Rule.RuleContext): {
|
|
44
|
-
CallExpression: (node: estree.CallExpression) => void;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
"rules-of-hooks": {
|
|
48
|
-
meta: {
|
|
49
|
-
type: "problem";
|
|
50
|
-
docs: {
|
|
51
|
-
description: string;
|
|
52
|
-
recommended: true;
|
|
53
|
-
url: string;
|
|
54
|
-
};
|
|
55
|
-
schema: {
|
|
56
|
-
type: "object";
|
|
57
|
-
additionalProperties: false;
|
|
58
|
-
properties: {
|
|
59
|
-
additionalHooks: {
|
|
60
|
-
type: "string";
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
}[];
|
|
64
|
-
};
|
|
65
|
-
create(context: import("eslint").Rule.RuleContext): {
|
|
66
|
-
"*"(node: any): void;
|
|
67
|
-
"*:exit"(node: any): void;
|
|
68
|
-
CallExpression(node: estree.CallExpression & import("eslint").Rule.NodeParentExtension): void;
|
|
69
|
-
Identifier(node: estree.Identifier & import("eslint").Rule.NodeParentExtension): void;
|
|
70
|
-
"CallExpression:exit"(node: estree.CallExpression & import("eslint").Rule.NodeParentExtension): void;
|
|
71
|
-
FunctionDeclaration(node: estree.FunctionDeclaration & import("eslint").Rule.NodeParentExtension): void;
|
|
72
|
-
ArrowFunctionExpression(node: estree.ArrowFunctionExpression & import("eslint").Rule.NodeParentExtension): void;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
configs: {
|
|
77
|
-
recommended: {
|
|
78
|
-
plugins: string[];
|
|
79
|
-
rules: import("eslint").Linter.RulesRecord;
|
|
80
|
-
};
|
|
81
|
-
"recommended-latest": {
|
|
82
|
-
plugins: string[];
|
|
83
|
-
rules: import("eslint").Linter.RulesRecord;
|
|
84
|
-
};
|
|
85
|
-
flat: {
|
|
86
|
-
recommended: {
|
|
87
|
-
plugins: {
|
|
88
|
-
react: any;
|
|
89
|
-
};
|
|
90
|
-
rules: import("eslint").Linter.RulesRecord;
|
|
91
|
-
};
|
|
92
|
-
"recommended-latest": {
|
|
93
|
-
plugins: {
|
|
94
|
-
react: any;
|
|
95
|
-
};
|
|
96
|
-
rules: import("eslint").Linter.RulesRecord;
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
"@nx": typeof nx;
|
|
102
|
-
};
|
|
103
|
-
languageOptions: {
|
|
104
|
-
parser: import("eslint").Linter.Parser;
|
|
105
|
-
};
|
|
106
|
-
files?: undefined;
|
|
107
|
-
rules?: undefined;
|
|
108
|
-
} | {
|
|
109
|
-
files: string[];
|
|
110
|
-
rules: {
|
|
111
|
-
"@typescript-eslint/explicit-module-boundary-types": string;
|
|
112
|
-
"jsdoc/require-jsdoc"?: undefined;
|
|
113
|
-
"no-console"?: undefined;
|
|
114
|
-
"@typescript-eslint/no-empty-function"?: undefined;
|
|
115
|
-
"@nx/dependency-checks"?: undefined;
|
|
116
|
-
};
|
|
117
|
-
plugins?: undefined;
|
|
118
|
-
languageOptions?: undefined;
|
|
119
|
-
} | {
|
|
120
|
-
files: string[];
|
|
121
|
-
rules: {
|
|
122
|
-
"jsdoc/require-jsdoc": string;
|
|
123
|
-
"no-console": string;
|
|
124
|
-
"@typescript-eslint/no-empty-function": string;
|
|
125
|
-
"@nx/dependency-checks"?: undefined;
|
|
126
|
-
};
|
|
127
|
-
plugins?: undefined;
|
|
128
|
-
languageOptions?: undefined;
|
|
129
|
-
} | {
|
|
130
|
-
files: string[];
|
|
131
|
-
languageOptions: {
|
|
132
|
-
parser: import("eslint").Linter.Parser;
|
|
133
|
-
};
|
|
134
|
-
rules: {
|
|
135
|
-
"@nx/dependency-checks": (string | {
|
|
136
|
-
ignoredDependencies: string[];
|
|
137
|
-
ignoredFiles: string[];
|
|
138
|
-
checkMissingDependencies: boolean;
|
|
139
|
-
checkObsoleteDependencies: boolean;
|
|
140
|
-
checkVersionMismatches: boolean;
|
|
141
|
-
})[];
|
|
142
|
-
"jsdoc/require-jsdoc"?: undefined;
|
|
143
|
-
"no-console"?: undefined;
|
|
144
|
-
"@typescript-eslint/no-empty-function"?: undefined;
|
|
145
|
-
};
|
|
146
|
-
plugins?: undefined;
|
|
147
|
-
})[];
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.publicApi = void 0;
|
|
4
|
-
const jsdoc_rules_1 = require("../fragments/jsdoc-rules");
|
|
5
|
-
const plugins_1 = require("../plugins");
|
|
6
|
-
exports.publicApi = [
|
|
7
|
-
{
|
|
8
|
-
plugins: {
|
|
9
|
-
"react-hooks": plugins_1.reactHooks,
|
|
10
|
-
"@nx": plugins_1.nx,
|
|
11
|
-
},
|
|
12
|
-
languageOptions: {
|
|
13
|
-
parser: plugins_1.tsParser,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
|
|
18
|
-
rules: {
|
|
19
|
-
...jsdoc_rules_1.strictJsdocRules,
|
|
20
|
-
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
files: ["**/*.stories.ts", "**/*.stories.tsx"],
|
|
25
|
-
rules: {
|
|
26
|
-
"jsdoc/require-jsdoc": "off",
|
|
27
|
-
"no-console": "off",
|
|
28
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
files: ["**/*.json"],
|
|
33
|
-
languageOptions: {
|
|
34
|
-
parser: plugins_1.jsoncParser,
|
|
35
|
-
},
|
|
36
|
-
rules: {
|
|
37
|
-
"@nx/dependency-checks": [
|
|
38
|
-
"error",
|
|
39
|
-
{
|
|
40
|
-
ignoredDependencies: [
|
|
41
|
-
"@trackunit/react-test-setup",
|
|
42
|
-
"@trackunit/iris-app-build-utilities",
|
|
43
|
-
"@trackunit/react-core-contexts-test",
|
|
44
|
-
"jest",
|
|
45
|
-
"jest-fetch-mock",
|
|
46
|
-
"jest-canvas-mock",
|
|
47
|
-
"@googlemaps/jest-mocks",
|
|
48
|
-
"jest-fail-on-console",
|
|
49
|
-
"@testing-library/react",
|
|
50
|
-
"@testing-library/jest-dom",
|
|
51
|
-
"@storybook/react-webpack5",
|
|
52
|
-
],
|
|
53
|
-
ignoredFiles: ["**/*.stories.tsx", "**/*.stories.ts", "**/storybook-utils/**", "**/storybookUtils.ts"],
|
|
54
|
-
checkMissingDependencies: true,
|
|
55
|
-
checkObsoleteDependencies: true,
|
|
56
|
-
checkVersionMismatches: true,
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
];
|
|
62
|
-
//# sourceMappingURL=public-api.js.map
|