@elnop/oxlint-config-zustand 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +18 -2
- package/dist/ZustandConfig.d.ts +91 -0
- package/dist/ZustandConfig.js +21 -0
- package/package.json +38 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 elnop
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @elnop/oxlint-config-zustand
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Oxlint config for zustand stores. It extends [@elnop/oxlint-config-typescript](https://www.npmjs.com/package/@elnop/oxlint-config-typescript) and turns on [@elnop/eslint-plugin-store-layout](https://www.npmjs.com/package/@elnop/eslint-plugin-store-layout): `viewStore.ts` only exports `viewStore` and `viewActions`.
|
|
4
|
+
|
|
5
|
+
In `*Store.ts` files, the base config's placement rule only refuses exported types, since a store exports the result of `create(...)`, and the file naming rule is off, since `store-layout` already checks the names.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install --save-dev oxlint @elnop/oxlint-config-zustand
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { reactConfig } from '@elnop/oxlint-config-react';
|
|
13
|
+
import { zustandConfig } from '@elnop/oxlint-config-zustand';
|
|
14
|
+
import { defineConfig } from 'oxlint';
|
|
15
|
+
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
extends: [reactConfig, zustandConfig],
|
|
18
|
+
});
|
|
19
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export declare const zustandConfig: {
|
|
2
|
+
extends: {
|
|
3
|
+
plugins: ("import" | "oxc" | "typescript" | "unicorn")[];
|
|
4
|
+
jsPlugins: {
|
|
5
|
+
name: string;
|
|
6
|
+
specifier: string;
|
|
7
|
+
}[];
|
|
8
|
+
categories: {
|
|
9
|
+
correctness: "error";
|
|
10
|
+
suspicious: "error";
|
|
11
|
+
};
|
|
12
|
+
env: {
|
|
13
|
+
es2024: true;
|
|
14
|
+
};
|
|
15
|
+
rules: {
|
|
16
|
+
'import/no-cycle': "error";
|
|
17
|
+
'import/no-self-import': "error";
|
|
18
|
+
'import/no-duplicates': "error";
|
|
19
|
+
'typescript/no-floating-promises': "error";
|
|
20
|
+
'typescript/no-misused-promises': "error";
|
|
21
|
+
'typescript/await-thenable': "error";
|
|
22
|
+
'typescript/no-unnecessary-type-assertion': "error";
|
|
23
|
+
'typescript/consistent-type-imports': "error";
|
|
24
|
+
'typescript/no-explicit-any': "error";
|
|
25
|
+
'no-shadow': "off";
|
|
26
|
+
'unicorn/consistent-function-scoping': "off";
|
|
27
|
+
'typescript/consistent-return': "off";
|
|
28
|
+
'oxc/no-barrel-file': ["error", {
|
|
29
|
+
threshold: number;
|
|
30
|
+
}];
|
|
31
|
+
'unicorn/filename-case': ["error", {
|
|
32
|
+
cases: {
|
|
33
|
+
camelCase: boolean;
|
|
34
|
+
pascalCase: boolean;
|
|
35
|
+
};
|
|
36
|
+
}];
|
|
37
|
+
'no-comments/disallowComments': ["error", {
|
|
38
|
+
allow: ("/ <reference " | "/usr/bin/env " | "@ts-expect-error" | "@ts-ignore" | "@ts-nocheck" | "eslint-" | "oxlint-")[];
|
|
39
|
+
}];
|
|
40
|
+
'check-file/no-index': ["error", {
|
|
41
|
+
errorMessage: "Barrel files ({{ target }}) are not allowed: import each module by its own path";
|
|
42
|
+
}];
|
|
43
|
+
'check-file/filename-blocklist': ["error", {
|
|
44
|
+
'**/types.ts': "*Types.ts";
|
|
45
|
+
}];
|
|
46
|
+
'file-named-after-export/file-named-after-export': "error";
|
|
47
|
+
};
|
|
48
|
+
overrides: ({
|
|
49
|
+
files: string[];
|
|
50
|
+
rules: {
|
|
51
|
+
'export-placement/no-restricted-syntax': ["error", ...{
|
|
52
|
+
selector: string;
|
|
53
|
+
message: string;
|
|
54
|
+
}[]];
|
|
55
|
+
'typescript/no-floating-promises'?: undefined;
|
|
56
|
+
'file-named-after-export/file-named-after-export'?: undefined;
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
files: string[];
|
|
60
|
+
rules: {
|
|
61
|
+
'typescript/no-floating-promises': "off";
|
|
62
|
+
'export-placement/no-restricted-syntax'?: undefined;
|
|
63
|
+
'file-named-after-export/file-named-after-export'?: undefined;
|
|
64
|
+
};
|
|
65
|
+
} | {
|
|
66
|
+
files: string[];
|
|
67
|
+
rules: {
|
|
68
|
+
'typescript/no-floating-promises'?: undefined;
|
|
69
|
+
'export-placement/no-restricted-syntax': "off";
|
|
70
|
+
'file-named-after-export/file-named-after-export': "off";
|
|
71
|
+
};
|
|
72
|
+
})[];
|
|
73
|
+
}[];
|
|
74
|
+
jsPlugins: {
|
|
75
|
+
name: string;
|
|
76
|
+
specifier: string;
|
|
77
|
+
}[];
|
|
78
|
+
rules: {
|
|
79
|
+
'store-layout/store-layout': "error";
|
|
80
|
+
};
|
|
81
|
+
overrides: {
|
|
82
|
+
files: string[];
|
|
83
|
+
rules: {
|
|
84
|
+
'file-named-after-export/file-named-after-export': "off";
|
|
85
|
+
'export-placement/no-restricted-syntax': ["error", {
|
|
86
|
+
selector: "ExportNamedDeclaration > :matches(TSTypeAliasDeclaration, TSInterfaceDeclaration)";
|
|
87
|
+
message: "Exported types belong in an XTypes.ts file (types/ folder).";
|
|
88
|
+
}];
|
|
89
|
+
};
|
|
90
|
+
}[];
|
|
91
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { typescriptConfig } from '@elnop/oxlint-config-typescript';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { defineConfig } from 'oxlint';
|
|
4
|
+
const resolveFromHere = (specifier) => fileURLToPath(import.meta.resolve(specifier));
|
|
5
|
+
export const zustandConfig = defineConfig({
|
|
6
|
+
extends: [typescriptConfig],
|
|
7
|
+
jsPlugins: [{ name: 'store-layout', specifier: resolveFromHere('@elnop/eslint-plugin-store-layout') }],
|
|
8
|
+
rules: { 'store-layout/store-layout': 'error' },
|
|
9
|
+
overrides: [
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*Store.ts'],
|
|
12
|
+
rules: {
|
|
13
|
+
'file-named-after-export/file-named-after-export': 'off',
|
|
14
|
+
'export-placement/no-restricted-syntax': [
|
|
15
|
+
'error',
|
|
16
|
+
{ selector: 'ExportNamedDeclaration > :matches(TSTypeAliasDeclaration, TSInterfaceDeclaration)', message: 'Exported types belong in an XTypes.ts file (types/ folder).' },
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elnop/oxlint-config-zustand",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Oxlint config for zustand stores: xStore.ts only exports xStore and xActions.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"oxlint",
|
|
7
|
+
"oxlint-config",
|
|
8
|
+
"zustand",
|
|
9
|
+
"lint"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/Elnop/eslint-plugins/tree/main/packages/configs/oxlint-config-zustand#readme",
|
|
12
|
+
"bugs": "https://github.com/Elnop/eslint-plugins/issues",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/Elnop/eslint-plugins.git",
|
|
16
|
+
"directory": "packages/configs/oxlint-config-zustand"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "elnop",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"!dist/tsconfig.tsbuildinfo"
|
|
24
|
+
],
|
|
25
|
+
"exports": "./dist/ZustandConfig.js",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"test": "node --test '**/*.test.ts'"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@elnop/eslint-plugin-store-layout": "^0.1.0",
|
|
31
|
+
"@elnop/oxlint-config-typescript": "^0.1.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"oxlint": "^1.91.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@elnop/lint-utils": "^0.1.0",
|
|
38
|
+
"oxlint": "^1.91.0"
|
|
39
|
+
}
|
|
40
|
+
}
|