@trackunit/eslint-plugin-trackunit 0.6.17 → 0.6.18
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 +15 -0
- package/package.json +1 -1
- package/src/lib/config/fragments/jest-overrides.js +2 -0
- package/src/lib/config/fragments/no-direct-storage-access.d.ts +4 -0
- package/src/lib/config/fragments/no-direct-storage-access.js +54 -0
- package/src/lib/config/index.d.ts +6 -1
- package/src/lib/config/presets/base.d.ts +1 -0
- package/src/lib/config/presets/base.js +2 -0
- package/src/lib/config/presets/react.d.ts +5 -1
- package/src/lib/config/presets/react.js +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## 0.6.18 (2026-06-08)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **eslint:** prohibit direct localStorage/sessionStorage access ([#23609](https://github.com/Trackunit/manager/pull/23609))
|
|
6
|
+
|
|
7
|
+
### 🧱 Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated shared-utils to 1.15.18
|
|
10
|
+
|
|
11
|
+
### ❤️ Thank You
|
|
12
|
+
|
|
13
|
+
- Cursor Agent @cursoragent
|
|
14
|
+
- Michael Buss Rønne @man-trackunit
|
|
15
|
+
|
|
1
16
|
## 0.6.17 (2026-06-08)
|
|
2
17
|
|
|
3
18
|
### 🩹 Fixes
|
package/package.json
CHANGED
|
@@ -24,6 +24,8 @@ exports.baseJestOverrides = {
|
|
|
24
24
|
"@trackunit/no-typescript-assertion": "off",
|
|
25
25
|
"@trackunit/no-jest-mock-trackunit-react-core-hooks": "error",
|
|
26
26
|
"no-console": "off",
|
|
27
|
+
"no-restricted-globals": "off",
|
|
28
|
+
"no-restricted-properties": "off",
|
|
27
29
|
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
28
30
|
},
|
|
29
31
|
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noDirectStoragePropertyExceptionOverrides = exports.noDirectStoragePropertiesRule = exports.noDirectStorageGlobalsRule = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const localStorageMessage = "Use useLocalStorage or useLocalStorageReducer from @trackunit/react-components instead of direct localStorage access.";
|
|
6
|
+
const sessionStorageMessage = "Use useSessionStorage or useSessionStorageReducer from @trackunit/react-components instead of direct sessionStorage access.";
|
|
7
|
+
exports.noDirectStorageGlobalsRule = [
|
|
8
|
+
"error",
|
|
9
|
+
{
|
|
10
|
+
name: "localStorage",
|
|
11
|
+
message: localStorageMessage,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "sessionStorage",
|
|
15
|
+
message: sessionStorageMessage,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
exports.noDirectStoragePropertiesRule = [
|
|
19
|
+
"error",
|
|
20
|
+
{
|
|
21
|
+
object: "window",
|
|
22
|
+
property: "localStorage",
|
|
23
|
+
message: localStorageMessage,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
object: "window",
|
|
27
|
+
property: "sessionStorage",
|
|
28
|
+
message: sessionStorageMessage,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
object: "globalThis",
|
|
32
|
+
property: "localStorage",
|
|
33
|
+
message: localStorageMessage,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
object: "globalThis",
|
|
37
|
+
property: "sessionStorage",
|
|
38
|
+
message: sessionStorageMessage,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
const storageHookImplementationFiles = [
|
|
42
|
+
"libs/react/components/src/hooks/localStorage/useLocalStorage.ts",
|
|
43
|
+
"libs/react/components/src/hooks/localStorage/useLocalStorageReducer.ts",
|
|
44
|
+
"libs/react/components/src/hooks/localStorage/useSessionStorage.ts",
|
|
45
|
+
"libs/react/components/src/hooks/localStorage/useSessionStorageReducer.ts",
|
|
46
|
+
];
|
|
47
|
+
exports.noDirectStoragePropertyExceptionOverrides = {
|
|
48
|
+
basePath: (0, utils_1.findMonorepoRoot)(),
|
|
49
|
+
files: storageHookImplementationFiles,
|
|
50
|
+
rules: {
|
|
51
|
+
"no-restricted-properties": "off",
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=no-direct-storage-access.js.map
|
|
@@ -149,6 +149,7 @@ export declare const configs: {
|
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
151
|
rules: {
|
|
152
|
+
"no-restricted-globals": import("eslint").Linter.RuleEntry<any[]>;
|
|
152
153
|
"@trackunit/no-internal-barrel-files": string;
|
|
153
154
|
"@trackunit/no-typescript-assertion": string;
|
|
154
155
|
"constructor-super": string;
|
|
@@ -303,7 +304,7 @@ export declare const configs: {
|
|
|
303
304
|
plugins?: undefined;
|
|
304
305
|
languageOptions?: undefined;
|
|
305
306
|
})[];
|
|
306
|
-
react: ({
|
|
307
|
+
react: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | {
|
|
307
308
|
plugins: {
|
|
308
309
|
"@trackunit": {
|
|
309
310
|
rules: {
|
|
@@ -820,6 +821,7 @@ export declare const configs: {
|
|
|
820
821
|
selector: string;
|
|
821
822
|
message: string;
|
|
822
823
|
})[];
|
|
824
|
+
"no-restricted-properties": import("eslint").Linter.RuleEntry<any[]>;
|
|
823
825
|
"no-multiple-empty-lines": (string | {
|
|
824
826
|
max: number;
|
|
825
827
|
})[];
|
|
@@ -842,6 +844,7 @@ export declare const configs: {
|
|
|
842
844
|
"@typescript-eslint/no-empty-function": string;
|
|
843
845
|
"@trackunit/one-component-per-file": string;
|
|
844
846
|
"@trackunit/component-name-matches-filename": string;
|
|
847
|
+
"no-restricted-properties"?: undefined;
|
|
845
848
|
};
|
|
846
849
|
plugins?: undefined;
|
|
847
850
|
settings?: undefined;
|
|
@@ -851,6 +854,7 @@ export declare const configs: {
|
|
|
851
854
|
rules: {
|
|
852
855
|
"@trackunit/one-component-per-file": string;
|
|
853
856
|
"@trackunit/component-name-matches-filename": string;
|
|
857
|
+
"no-restricted-properties": string;
|
|
854
858
|
"jsdoc/require-jsdoc"?: undefined;
|
|
855
859
|
"no-console"?: undefined;
|
|
856
860
|
"@typescript-eslint/no-empty-function"?: undefined;
|
|
@@ -931,6 +935,7 @@ export declare const configs: {
|
|
|
931
935
|
"@typescript-eslint/no-empty-function"?: undefined;
|
|
932
936
|
"@trackunit/one-component-per-file"?: undefined;
|
|
933
937
|
"@trackunit/component-name-matches-filename"?: undefined;
|
|
938
|
+
"no-restricted-properties"?: undefined;
|
|
934
939
|
};
|
|
935
940
|
settings?: undefined;
|
|
936
941
|
})[];
|
|
@@ -149,6 +149,7 @@ export declare const base: (import("eslint").Linter.FlatConfig<import("eslint").
|
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
151
|
rules: {
|
|
152
|
+
"no-restricted-globals": import("eslint").Linter.RuleEntry<any[]>;
|
|
152
153
|
"@trackunit/no-internal-barrel-files": string;
|
|
153
154
|
"@trackunit/no-typescript-assertion": string;
|
|
154
155
|
"constructor-super": string;
|
|
@@ -7,6 +7,7 @@ const import_rules_1 = require("../fragments/import-rules");
|
|
|
7
7
|
const jest_overrides_1 = require("../fragments/jest-overrides");
|
|
8
8
|
const jsdoc_rules_1 = require("../fragments/jsdoc-rules");
|
|
9
9
|
const module_boundaries_1 = require("../fragments/module-boundaries");
|
|
10
|
+
const no_direct_storage_access_1 = require("../fragments/no-direct-storage-access");
|
|
10
11
|
const restricted_imports_1 = require("../fragments/restricted-imports");
|
|
11
12
|
const typescript_rules_1 = require("../fragments/typescript-rules");
|
|
12
13
|
const plugins_1 = require("../plugins");
|
|
@@ -105,6 +106,7 @@ exports.base = [
|
|
|
105
106
|
"no-unused-expressions": "off",
|
|
106
107
|
"no-shadow": "off",
|
|
107
108
|
...jsdoc_rules_1.basicJsdocRules,
|
|
109
|
+
"no-restricted-globals": no_direct_storage_access_1.noDirectStorageGlobalsRule,
|
|
108
110
|
"@trackunit/no-internal-barrel-files": "error",
|
|
109
111
|
"@trackunit/no-typescript-assertion": "warn",
|
|
110
112
|
...import_rules_1.importRules,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { nx, react } from "../plugins";
|
|
2
|
-
export declare const reactPreset: ({
|
|
2
|
+
export declare const reactPreset: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | {
|
|
3
3
|
plugins: {
|
|
4
4
|
"@trackunit": {
|
|
5
5
|
rules: {
|
|
@@ -516,6 +516,7 @@ export declare const reactPreset: ({
|
|
|
516
516
|
selector: string;
|
|
517
517
|
message: string;
|
|
518
518
|
})[];
|
|
519
|
+
"no-restricted-properties": import("eslint").Linter.RuleEntry<any[]>;
|
|
519
520
|
"no-multiple-empty-lines": (string | {
|
|
520
521
|
max: number;
|
|
521
522
|
})[];
|
|
@@ -538,6 +539,7 @@ export declare const reactPreset: ({
|
|
|
538
539
|
"@typescript-eslint/no-empty-function": string;
|
|
539
540
|
"@trackunit/one-component-per-file": string;
|
|
540
541
|
"@trackunit/component-name-matches-filename": string;
|
|
542
|
+
"no-restricted-properties"?: undefined;
|
|
541
543
|
};
|
|
542
544
|
plugins?: undefined;
|
|
543
545
|
settings?: undefined;
|
|
@@ -547,6 +549,7 @@ export declare const reactPreset: ({
|
|
|
547
549
|
rules: {
|
|
548
550
|
"@trackunit/one-component-per-file": string;
|
|
549
551
|
"@trackunit/component-name-matches-filename": string;
|
|
552
|
+
"no-restricted-properties": string;
|
|
550
553
|
"jsdoc/require-jsdoc"?: undefined;
|
|
551
554
|
"no-console"?: undefined;
|
|
552
555
|
"@typescript-eslint/no-empty-function"?: undefined;
|
|
@@ -627,6 +630,7 @@ export declare const reactPreset: ({
|
|
|
627
630
|
"@typescript-eslint/no-empty-function"?: undefined;
|
|
628
631
|
"@trackunit/one-component-per-file"?: undefined;
|
|
629
632
|
"@trackunit/component-name-matches-filename"?: undefined;
|
|
633
|
+
"no-restricted-properties"?: undefined;
|
|
630
634
|
};
|
|
631
635
|
settings?: undefined;
|
|
632
636
|
})[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reactPreset = void 0;
|
|
4
|
+
const no_direct_storage_access_1 = require("../fragments/no-direct-storage-access");
|
|
4
5
|
const react_rules_1 = require("../fragments/react-rules");
|
|
5
6
|
const testing_library_1 = require("../fragments/testing-library");
|
|
6
7
|
const plugins_1 = require("../plugins");
|
|
@@ -58,8 +59,10 @@ exports.reactPreset = [
|
|
|
58
59
|
message: "Please use string literal union or objects instead of enums.",
|
|
59
60
|
},
|
|
60
61
|
],
|
|
62
|
+
"no-restricted-properties": no_direct_storage_access_1.noDirectStoragePropertiesRule,
|
|
61
63
|
},
|
|
62
64
|
},
|
|
65
|
+
no_direct_storage_access_1.noDirectStoragePropertyExceptionOverrides,
|
|
63
66
|
{
|
|
64
67
|
files: ["**/*.stories.ts", "**/*.stories.tsx"],
|
|
65
68
|
rules: {
|
|
@@ -75,6 +78,7 @@ exports.reactPreset = [
|
|
|
75
78
|
rules: {
|
|
76
79
|
"@trackunit/one-component-per-file": "off",
|
|
77
80
|
"@trackunit/component-name-matches-filename": "off",
|
|
81
|
+
"no-restricted-properties": "off",
|
|
78
82
|
},
|
|
79
83
|
},
|
|
80
84
|
{
|