@trackunit/eslint-plugin-trackunit 0.7.24 β 0.8.0
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 +31 -0
- package/README.md +19 -15
- package/package.json +2 -2
- package/src/lib/config/fragments/import-rules.js +1 -1
- package/src/lib/config/fragments/react-rules.js +6 -6
- package/src/lib/config/fragments/typescript-rules.js +5 -5
- package/src/lib/config/index.d.ts +1 -1
- package/src/lib/config/presets/base.js +2 -2
- package/src/lib/config/presets/react.d.ts +1 -1
- package/src/lib/config/presets/react.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
## 0.8.0 (2026-11-10)
|
|
2
|
+
|
|
3
|
+
### π Features
|
|
4
|
+
|
|
5
|
+
- β οΈ **eslint-plugin-trackunit:** ship lint rules as error and ratchet lint warning budgets down automatically [DS-290] ([#27037](https://github.com/Trackunit/manager/pull/27037))
|
|
6
|
+
|
|
7
|
+
### β οΈ Breaking Changes
|
|
8
|
+
|
|
9
|
+
- **eslint-plugin-trackunit:** ship lint rules as error and ratchet lint warning budgets down automatically [DS-290] ([#27037](https://github.com/Trackunit/manager/pull/27037))
|
|
10
|
+
rules that the presets used to set to warn are now error:
|
|
11
|
+
@trackunit/no-typescript-assertion, @trackunit/no-deprecated-graphql-fields,
|
|
12
|
+
@typescript-eslint/strict-boolean-expressions, @typescript-eslint/no-non-null-assertion,
|
|
13
|
+
@typescript-eslint/await-thenable, @typescript-eslint/ban-ts-comment,
|
|
14
|
+
@typescript-eslint/no-require-imports, import-x/no-default-export,
|
|
15
|
+
no-restricted-syntax (enums), react/no-unstable-nested-components,
|
|
16
|
+
react/jsx-no-constructed-context-values, react-hooks/refs, react-hooks/set-state-in-effect,
|
|
17
|
+
react-hooks/preserve-manual-memoization, react-hooks/incompatible-library,
|
|
18
|
+
testing-library/no-debugging-utils.
|
|
19
|
+
Consumers may see new lint errors after upgrading.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### π§± Updated Dependencies
|
|
23
|
+
|
|
24
|
+
- Updated css-classname-utils to 0.0.118
|
|
25
|
+
- Updated shared-utils to 1.22.37
|
|
26
|
+
|
|
27
|
+
### β€οΈ Thank You
|
|
28
|
+
|
|
29
|
+
- CircleCI
|
|
30
|
+
- Michael Buss RΓΈnne @man-trackunit
|
|
31
|
+
|
|
1
32
|
## 0.7.24 (2026-11-09)
|
|
2
33
|
|
|
3
34
|
### π§± Updated Dependencies
|
package/README.md
CHANGED
|
@@ -40,34 +40,38 @@ module.exports = [...configs.base, ...configs.react];
|
|
|
40
40
|
|
|
41
41
|
`configs.base` should always come first.
|
|
42
42
|
|
|
43
|
+
### Severities and Upgrades
|
|
44
|
+
|
|
45
|
+
The presets ship every enabled rule as `error`; none are set to `warn`. Adding a rule to a preset, or raising a rule's severity, is released as a breaking change: a breaking version bump (the minor version while the package is below `1.0.0`) with a "Breaking Changes" changelog entry. If you need time to fix new violations after upgrading, lower those rules to `warn` in your own config. Future releases will also list newly added rules when you upgrade.
|
|
46
|
+
|
|
43
47
|
## Custom Rules
|
|
44
48
|
|
|
45
|
-
All custom rules are enabled automatically through the presets under the `@trackunit/` prefix
|
|
49
|
+
All custom rules are enabled automatically through the presets under the `@trackunit/` prefix, unless their Severity is `β`. Below is a summary of every rule shipped with the plugin.
|
|
46
50
|
|
|
47
51
|
### Code Quality
|
|
48
52
|
|
|
49
53
|
|
|
50
54
|
| Rule | Severity | Auto-fix | Description |
|
|
51
55
|
| ---------------------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------ |
|
|
52
|
-
| `@trackunit/no-typescript-assertion` |
|
|
56
|
+
| `@trackunit/no-typescript-assertion` | error | β | Disallows `as`, angle-bracket, and `!` type assertions. `as const` and `as unknown` are allowed. |
|
|
53
57
|
| `@trackunit/no-internal-barrel-files` | error | β | Prevents internal `index.ts` barrel files that are not at the library root. |
|
|
54
|
-
| `@trackunit/prefer-destructured-imports` |
|
|
58
|
+
| `@trackunit/prefer-destructured-imports` | error | yes | Converts namespace imports (`import * as Foo`) to named imports for configured packages. |
|
|
55
59
|
|
|
56
60
|
|
|
57
61
|
### React & JSX
|
|
58
62
|
|
|
59
63
|
| Rule | Severity | Auto-fix | Description |
|
|
60
64
|
| ------------------------------------------------------ | -------- | -------- | ------------------------------------------------------------------------------------------ |
|
|
61
|
-
| `@trackunit/no-template-strings-in-classname-prop` |
|
|
62
|
-
| `@trackunit/require-classname-alternatives` |
|
|
63
|
-
| `@trackunit/cva-merge-base-classes-as-array` |
|
|
64
|
-
| `@trackunit/design-guideline-icon-size-match` |
|
|
65
|
-
| `@trackunit/prefer-field-components` |
|
|
66
|
-
| `@trackunit/prefer-mouse-event-handler-in-react-props` |
|
|
67
|
-
| `@trackunit/prefer-event-specific-callback-naming` |
|
|
68
|
-
| `@trackunit/require-optional-prop-initialization` |
|
|
65
|
+
| `@trackunit/no-template-strings-in-classname-prop` | error | β | Disallows template literals in `className`. Use `cx()` or `cva()` instead. |
|
|
66
|
+
| `@trackunit/require-classname-alternatives` | error | yes | Replaces banned class names with approved alternatives. |
|
|
67
|
+
| `@trackunit/cva-merge-base-classes-as-array` | error | yes | Enforces array syntax for `cva` base classes when more than one class is used. |
|
|
68
|
+
| `@trackunit/design-guideline-icon-size-match` | error | yes | Ensures `Icon` in `Button`, `Tag`, and `getOptionPrefix` uses the correct `size` prop. |
|
|
69
|
+
| `@trackunit/prefer-field-components` | error | yes | Prefers `SelectField`/`TextField` over manually combining `Label` + base input components. |
|
|
70
|
+
| `@trackunit/prefer-mouse-event-handler-in-react-props` | error | β | Enforces `MouseEventHandler<T>` typing for `onClick*` props. |
|
|
71
|
+
| `@trackunit/prefer-event-specific-callback-naming` | error | β | Enforces event-specific naming (e.g. `onClickClose` over `onClose`) for click handlers. |
|
|
72
|
+
| `@trackunit/require-optional-prop-initialization` | error | β | Requires optional component props to be initialized inside the component. |
|
|
69
73
|
| `@trackunit/require-component-prop-contracts` | β | β | Requires public component props to satisfy configured prop/interface contracts. |
|
|
70
|
-
| `@trackunit/require-list-item-virtualization-props` |
|
|
74
|
+
| `@trackunit/require-list-item-virtualization-props` | error | β | Requires `VirtualizationListItemProps` on list items inside `<List>`. |
|
|
71
75
|
| `@trackunit/one-component-per-file` | error | β | Enforces at most one exported React component per file. `exportedOnly: false` restricts to one total. |
|
|
72
76
|
| `@trackunit/component-name-matches-filename` | error | β | Enforces that exported React component names match the filename (e.g. `Foo` in `Foo.tsx`). |
|
|
73
77
|
|
|
@@ -77,10 +81,10 @@ The published `react` preset registers `@trackunit/structure` and does not enabl
|
|
|
77
81
|
|
|
78
82
|
| Rule | Severity | Auto-fix | Description |
|
|
79
83
|
| -------------------------------------------------- | -------- | -------- | ---------------------------------------------------------------------------------------------------- |
|
|
80
|
-
| `@trackunit/structure/require-component-directory` | β | β | Not enabled by this preset. Manager
|
|
81
|
-
| `@trackunit/structure/require-nested-components-directory` | β | β | Not enabled by this preset. Manager
|
|
84
|
+
| `@trackunit/structure/require-component-directory` | β | β | Not enabled by this preset. Manager enables it as `error` through the internal `folderStructure` preset and phases it in (`warn` until no project violates it). One directory per component under `components/`. |
|
|
85
|
+
| `@trackunit/structure/require-nested-components-directory` | β | β | Not enabled by this preset. Manager enables it as `error` through the internal `folderStructure` preset and phases it in (`warn` until no project violates it). Exported child components live under `<Parent>/components/`. |
|
|
82
86
|
| `@trackunit/structure/require-nested-components-privacy` | β | β | Not enabled. Review guidance for private `components/<Child>/` imports. |
|
|
83
|
-
| `@trackunit/structure/require-hook-util-directory` | β | β | Not enabled by this preset. Manager
|
|
87
|
+
| `@trackunit/structure/require-hook-util-directory` | β | β | Not enabled by this preset. Manager enables it as `error` through the internal `folderStructure` preset and phases it in (`warn` until no project violates it). One directory per hook or util under `hooks/` or `utils/`. |
|
|
84
88
|
| `@trackunit/structure/require-page-directory` | β | β | Not enabled. Review guidance for route `component`s in `pages/<Name>/<Name>.tsx`. |
|
|
85
89
|
|
|
86
90
|
### Testing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/eslint-plugin-trackunit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"repository": "https://github.com/Trackunit/manager",
|
|
6
6
|
"engines": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@nx/eslint-plugin": "23.3.0",
|
|
11
|
-
"@trackunit/css-classname-utils": "0.0.
|
|
11
|
+
"@trackunit/css-classname-utils": "0.0.118",
|
|
12
12
|
"@typescript-eslint/eslint-plugin": "8.71.2",
|
|
13
13
|
"@typescript-eslint/utils": "8.71.2",
|
|
14
14
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -11,7 +11,7 @@ exports.importRules = {
|
|
|
11
11
|
},
|
|
12
12
|
],
|
|
13
13
|
"import-x/first": "off",
|
|
14
|
-
"import-x/no-default-export": "
|
|
14
|
+
"import-x/no-default-export": "error",
|
|
15
15
|
};
|
|
16
16
|
const createImportExtraneousDependenciesConfig = (rootDir) => (0, create_skip_when_1.createSkipWhen)({
|
|
17
17
|
when: { tags: ["scope:tool"] },
|
|
@@ -16,12 +16,12 @@ exports.reactRules = {
|
|
|
16
16
|
"react-hooks/static-components": "error",
|
|
17
17
|
"react-hooks/purity": "error",
|
|
18
18
|
"react-hooks/immutability": "error",
|
|
19
|
-
"react/no-unstable-nested-components": "
|
|
20
|
-
"react-hooks/refs": "
|
|
21
|
-
"react-hooks/set-state-in-effect": "
|
|
22
|
-
"react-hooks/preserve-manual-memoization": "
|
|
23
|
-
"react-hooks/incompatible-library": "
|
|
24
|
-
"react/jsx-no-constructed-context-values": "
|
|
19
|
+
"react/no-unstable-nested-components": "error",
|
|
20
|
+
"react-hooks/refs": "error",
|
|
21
|
+
"react-hooks/set-state-in-effect": "error",
|
|
22
|
+
"react-hooks/preserve-manual-memoization": "error",
|
|
23
|
+
"react-hooks/incompatible-library": "error",
|
|
24
|
+
"react/jsx-no-constructed-context-values": "error",
|
|
25
25
|
"react/jsx-curly-brace-presence": [
|
|
26
26
|
"error",
|
|
27
27
|
{
|
|
@@ -33,7 +33,7 @@ exports.typescriptRules = {
|
|
|
33
33
|
},
|
|
34
34
|
],
|
|
35
35
|
"@typescript-eslint/strict-boolean-expressions": [
|
|
36
|
-
"
|
|
36
|
+
"error",
|
|
37
37
|
{
|
|
38
38
|
allowNullableBoolean: true,
|
|
39
39
|
allowNullableString: true,
|
|
@@ -58,12 +58,12 @@ exports.typescriptRules = {
|
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
60
|
],
|
|
61
|
-
"@typescript-eslint/no-non-null-assertion": "
|
|
61
|
+
"@typescript-eslint/no-non-null-assertion": "error",
|
|
62
62
|
"@typescript-eslint/no-empty-function": "error",
|
|
63
63
|
"@typescript-eslint/no-unused-expressions": "error",
|
|
64
64
|
"@typescript-eslint/dot-notation": "error",
|
|
65
|
-
"@typescript-eslint/await-thenable": "
|
|
66
|
-
"@typescript-eslint/ban-ts-comment": "
|
|
65
|
+
"@typescript-eslint/await-thenable": "error",
|
|
66
|
+
"@typescript-eslint/ban-ts-comment": "error",
|
|
67
67
|
"@typescript-eslint/member-ordering": "error",
|
|
68
68
|
"@typescript-eslint/no-empty-object-type": "error",
|
|
69
69
|
"@typescript-eslint/no-floating-promises": "error",
|
|
@@ -79,7 +79,7 @@ exports.typescriptRules = {
|
|
|
79
79
|
},
|
|
80
80
|
],
|
|
81
81
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
82
|
-
"@typescript-eslint/no-require-imports": "
|
|
82
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
83
83
|
"@typescript-eslint/no-restricted-types": [
|
|
84
84
|
"error",
|
|
85
85
|
{
|
|
@@ -1171,7 +1171,7 @@ export declare const configs: {
|
|
|
1171
1171
|
parserOptions?: undefined;
|
|
1172
1172
|
};
|
|
1173
1173
|
rules: {
|
|
1174
|
-
|
|
1174
|
+
"testing-library/no-debugging-utils": string;
|
|
1175
1175
|
"@trackunit/one-component-per-file"?: undefined;
|
|
1176
1176
|
"@trackunit/component-name-matches-filename"?: undefined;
|
|
1177
1177
|
"no-restricted-properties"?: undefined;
|
|
@@ -136,7 +136,7 @@ exports.base = [
|
|
|
136
136
|
...jsdoc_rules_1.basicJsdocRules,
|
|
137
137
|
"no-restricted-globals": no_direct_storage_access_1.noDirectStorageGlobalsRule,
|
|
138
138
|
"@trackunit/no-internal-barrel-files": "error",
|
|
139
|
-
"@trackunit/no-typescript-assertion": "
|
|
139
|
+
"@trackunit/no-typescript-assertion": "error",
|
|
140
140
|
"@trackunit/no-dynamic-translation-key": "error",
|
|
141
141
|
...import_rules_1.importRules,
|
|
142
142
|
...typescript_rules_1.typescriptRules,
|
|
@@ -152,7 +152,7 @@ exports.base = [
|
|
|
152
152
|
},
|
|
153
153
|
rules: {
|
|
154
154
|
"@trackunit/no-internal-graphql-when-tagged-with-gql-public": "error",
|
|
155
|
-
"@trackunit/no-deprecated-graphql-fields": "
|
|
155
|
+
"@trackunit/no-deprecated-graphql-fields": "error",
|
|
156
156
|
},
|
|
157
157
|
},
|
|
158
158
|
{
|
|
@@ -661,7 +661,7 @@ export declare const reactPreset: (import("eslint").Linter.Config<import("eslint
|
|
|
661
661
|
parserOptions?: undefined;
|
|
662
662
|
};
|
|
663
663
|
rules: {
|
|
664
|
-
|
|
664
|
+
"testing-library/no-debugging-utils": string;
|
|
665
665
|
"@trackunit/one-component-per-file"?: undefined;
|
|
666
666
|
"@trackunit/component-name-matches-filename"?: undefined;
|
|
667
667
|
"no-restricted-properties"?: undefined;
|
|
@@ -92,7 +92,7 @@ exports.reactPreset = [
|
|
|
92
92
|
"prefer-spread": "error",
|
|
93
93
|
...react_rules_1.reactRules,
|
|
94
94
|
"no-restricted-syntax": [
|
|
95
|
-
"
|
|
95
|
+
"error",
|
|
96
96
|
{
|
|
97
97
|
selector: "TSEnumDeclaration",
|
|
98
98
|
message: "Please use string literal union or objects instead of enums.",
|
|
@@ -133,6 +133,8 @@ exports.reactPreset = [
|
|
|
133
133
|
},
|
|
134
134
|
rules: {
|
|
135
135
|
...testing_library_1.reactTestingLibraryRules,
|
|
136
|
+
// The recommended config sets this to `warn`; presets ship every rule as `error`.
|
|
137
|
+
"testing-library/no-debugging-utils": "error",
|
|
136
138
|
},
|
|
137
139
|
},
|
|
138
140
|
];
|