@vfourny/node-toolkit 1.0.22 → 1.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/README.md +116 -7
- package/dist/configs/eslint/base.d.ts +10 -0
- package/dist/configs/eslint/base.js +105 -0
- package/dist/configs/eslint/index.d.ts +5 -0
- package/dist/configs/eslint/index.js +5 -0
- package/dist/configs/eslint/node.d.ts +4 -0
- package/dist/configs/eslint/node.js +12 -0
- package/dist/configs/eslint/nuxt.d.ts +2 -0
- package/dist/configs/eslint/nuxt.js +73 -0
- package/dist/configs/eslint/vue.d.ts +4 -0
- package/dist/configs/eslint/vue.js +28 -0
- package/dist/eslint.config.d.ts +1 -1
- package/dist/eslint.config.js +6 -120
- package/package.json +44 -21
package/README.md
CHANGED
|
@@ -23,6 +23,23 @@ To install **VFourny's Node Toolkit** via npm, make sure you have [Node.js](http
|
|
|
23
23
|
npm install -D @vfourny/node-toolkit
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
### Peer Dependencies
|
|
27
|
+
|
|
28
|
+
This package requires the following peer dependencies to be installed in your project:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -D eslint prettier typescript commitlint semantic-release
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Minimum versions:**
|
|
35
|
+
|
|
36
|
+
- Node.js: `>=20.13 <25`
|
|
37
|
+
- ESLint: `^9.3.0`
|
|
38
|
+
- Prettier: `^3.2.5`
|
|
39
|
+
- TypeScript: `^5.5.2`
|
|
40
|
+
- Commitlint: `^19.8.0 || ^20.1.0`
|
|
41
|
+
- Semantic Release: `^24.0.0 || ^25.0.0`
|
|
42
|
+
|
|
26
43
|
## Environment Variables
|
|
27
44
|
|
|
28
45
|
For `semantic-release` to work properly, certain environment variables must be defined in your GitHub repository configuration.
|
|
@@ -42,17 +59,103 @@ For `semantic-release` to work properly, certain environment variables must be d
|
|
|
42
59
|
|
|
43
60
|
### ESLint
|
|
44
61
|
|
|
45
|
-
|
|
62
|
+
This package provides multiple ESLint configurations tailored for different project types. Choose the one that fits your project:
|
|
46
63
|
|
|
47
|
-
|
|
48
|
-
import nodeToolkitEslintConfig from '@vfourny/node-toolkit/eslint'
|
|
64
|
+
#### For Node.js Projects
|
|
49
65
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
```typescript
|
|
67
|
+
// eslint.config.ts
|
|
68
|
+
import nodeConfig from '@vfourny/node-toolkit/eslint/node'
|
|
69
|
+
|
|
70
|
+
export default nodeConfig
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### For Vue Projects
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
// eslint.config.ts
|
|
77
|
+
import vueConfig from '@vfourny/node-toolkit/eslint/vue'
|
|
78
|
+
|
|
79
|
+
export default vueConfig
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### For Nuxt Projects
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
// eslint.config.ts
|
|
86
|
+
import nuxtConfig from '@vfourny/node-toolkit/eslint/nuxt'
|
|
87
|
+
|
|
88
|
+
export default nuxtConfig
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Default Import (Node.js)
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// eslint.config.ts
|
|
95
|
+
import config from '@vfourny/node-toolkit/eslint'
|
|
96
|
+
|
|
97
|
+
export default config
|
|
54
98
|
```
|
|
55
99
|
|
|
100
|
+
#### Advanced Usage
|
|
101
|
+
|
|
102
|
+
For advanced users who want to compose their own configuration:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// eslint.config.ts
|
|
106
|
+
import {
|
|
107
|
+
baseConfig,
|
|
108
|
+
nodeGlobalsConfig,
|
|
109
|
+
typescriptConfigs,
|
|
110
|
+
prettierConfig,
|
|
111
|
+
} from '@vfourny/node-toolkit/eslint/base'
|
|
112
|
+
import typescriptEslint from 'typescript-eslint'
|
|
113
|
+
|
|
114
|
+
export default typescriptEslint.config(
|
|
115
|
+
...typescriptConfigs,
|
|
116
|
+
nodeGlobalsConfig,
|
|
117
|
+
baseConfig,
|
|
118
|
+
// Your custom configs here
|
|
119
|
+
prettierConfig, // Should be last
|
|
120
|
+
)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Configuration Rules Overview
|
|
124
|
+
|
|
125
|
+
All ESLint configurations include the following enforced rules:
|
|
126
|
+
|
|
127
|
+
**Code Quality:**
|
|
128
|
+
|
|
129
|
+
- `eqeqeq`: Require `===` and `!==` instead of `==` and `!=`
|
|
130
|
+
- `prefer-const`: Prefer `const` over `let` when variables are not reassigned
|
|
131
|
+
- `no-console`: Disallow `console.log` statements (prevents debug code in production)
|
|
132
|
+
- `no-debugger`: Disallow `debugger` statements
|
|
133
|
+
- `no-var`: Require `let` or `const` instead of `var`
|
|
134
|
+
|
|
135
|
+
**TypeScript:**
|
|
136
|
+
|
|
137
|
+
- `@typescript-eslint/consistent-type-definitions`: Enforce `interface` over `type`
|
|
138
|
+
- `@typescript-eslint/no-explicit-any`: Disallow `any` type (suggests `unknown` instead)
|
|
139
|
+
- `@typescript-eslint/consistent-type-imports`: Enforce `import type` for type-only imports
|
|
140
|
+
- `@typescript-eslint/no-unused-vars`: Disallow unused variables (except those prefixed with `_`)
|
|
141
|
+
- `@typescript-eslint/naming-convention`: Enforce naming conventions (PascalCase for classes, camelCase for variables, etc.)
|
|
142
|
+
|
|
143
|
+
**Import Rules:**
|
|
144
|
+
|
|
145
|
+
- `no-restricted-imports`: **Disallow relative imports** - must use absolute imports with `@/` prefix
|
|
146
|
+
- `import/no-default-export`: Disallow default exports (except in `*.config.{js,ts}` files)
|
|
147
|
+
- `simple-import-sort/imports`: Auto-sort imports alphabetically
|
|
148
|
+
- `simple-import-sort/exports`: Auto-sort exports alphabetically
|
|
149
|
+
|
|
150
|
+
**Project-Specific:**
|
|
151
|
+
|
|
152
|
+
- **Node.js**: Includes Node.js global variables (`process`, `__dirname`, etc.)
|
|
153
|
+
- **Vue**: Includes Vue ESLint plugin rules, enforces PascalCase for component names in templates
|
|
154
|
+
- **Nuxt**: Includes Vue rules + auto-import globals for Nuxt composables (`useRouter`, `useFetch`, etc.), allows single-word component names for pages
|
|
155
|
+
|
|
156
|
+
**Import Resolution:**
|
|
157
|
+
All configurations automatically resolve TypeScript path aliases (like `@/*`) using `eslint-import-resolver-typescript`.
|
|
158
|
+
|
|
56
159
|
### Prettier
|
|
57
160
|
|
|
58
161
|
To import the Prettier configuration into your project, add the following code to your [Prettier](https://prettier.io/docs/en/configuration.html) configuration file:
|
|
@@ -74,11 +177,17 @@ To import the TypeScript configuration into your project, add the following code
|
|
|
74
177
|
{
|
|
75
178
|
"extends": "@vfourny/node-toolkit/tsconfig",
|
|
76
179
|
"compilerOptions": {
|
|
180
|
+
"baseUrl": ".",
|
|
181
|
+
"paths": {
|
|
182
|
+
"@/*": ["./src/*"]
|
|
183
|
+
}
|
|
77
184
|
// Your custom configurations
|
|
78
185
|
}
|
|
79
186
|
}
|
|
80
187
|
```
|
|
81
188
|
|
|
189
|
+
**Important:** The `paths` configuration is required for the ESLint import resolver to work correctly with absolute imports using the `@/` prefix.
|
|
190
|
+
|
|
82
191
|
### Semantic Release
|
|
83
192
|
|
|
84
193
|
To import the Semantic Release configuration into your project, add the following code to your [Semantic Release](https://semantic-release.gitbook.io/semantic-release) configuration file:
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
export declare const baseConfig: Linter.Config;
|
|
3
|
+
export declare const commonIgnores: Linter.Config;
|
|
4
|
+
export declare const configFilesOverride: Linter.Config;
|
|
5
|
+
export declare const typescriptConfigs: ({
|
|
6
|
+
readonly rules: Readonly<Linter.RulesRecord>;
|
|
7
|
+
} | import("node_modules/typescript-eslint/dist/compatibility-types").CompatibleConfig)[];
|
|
8
|
+
export declare const prettierConfig: {
|
|
9
|
+
rules: Record<string, 0 | "off">;
|
|
10
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import eslintJS from '@eslint/js';
|
|
2
|
+
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
3
|
+
import importPlugin from 'eslint-plugin-import';
|
|
4
|
+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
5
|
+
import typescriptEslint from 'typescript-eslint';
|
|
6
|
+
export const baseConfig = {
|
|
7
|
+
name: 'node-toolkit/base',
|
|
8
|
+
plugins: {
|
|
9
|
+
import: importPlugin,
|
|
10
|
+
'simple-import-sort': simpleImportSort,
|
|
11
|
+
},
|
|
12
|
+
settings: {
|
|
13
|
+
'import/resolver': {
|
|
14
|
+
typescript: {
|
|
15
|
+
alwaysTryTypes: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
eqeqeq: ['error', 'always'],
|
|
21
|
+
'prefer-const': ['error', { destructuring: 'all' }],
|
|
22
|
+
'no-useless-rename': 'error',
|
|
23
|
+
'no-useless-constructor': 'error',
|
|
24
|
+
'no-console': 'error',
|
|
25
|
+
'no-debugger': 'error',
|
|
26
|
+
'no-throw-literal': 'error',
|
|
27
|
+
'no-unused-expressions': 'error',
|
|
28
|
+
'no-var': 'error',
|
|
29
|
+
'no-redeclare': 'error',
|
|
30
|
+
'no-const-assign': 'error',
|
|
31
|
+
'no-restricted-imports': [
|
|
32
|
+
'error',
|
|
33
|
+
{
|
|
34
|
+
patterns: [
|
|
35
|
+
{
|
|
36
|
+
group: ['../*', './*'],
|
|
37
|
+
message: 'Relative imports are not allowed. Use absolute imports instead with @/.',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
'sort-imports': 'off',
|
|
43
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
44
|
+
'@typescript-eslint/no-explicit-any': ['error', { fixToUnknown: true }],
|
|
45
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
46
|
+
'error',
|
|
47
|
+
{ prefer: 'type-imports' },
|
|
48
|
+
],
|
|
49
|
+
'@typescript-eslint/no-unused-vars': [
|
|
50
|
+
'error',
|
|
51
|
+
{
|
|
52
|
+
argsIgnorePattern: '^_',
|
|
53
|
+
varsIgnorePattern: '^_',
|
|
54
|
+
caughtErrorsIgnorePattern: '^_',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
'@typescript-eslint/naming-convention': [
|
|
58
|
+
'error',
|
|
59
|
+
{
|
|
60
|
+
selector: 'import',
|
|
61
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
62
|
+
},
|
|
63
|
+
{ selector: 'class', format: ['PascalCase'] },
|
|
64
|
+
{
|
|
65
|
+
selector: 'variable',
|
|
66
|
+
modifiers: ['const'],
|
|
67
|
+
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
selector: 'typeParameter',
|
|
71
|
+
format: ['PascalCase'],
|
|
72
|
+
},
|
|
73
|
+
{ selector: 'enum', format: ['PascalCase'] },
|
|
74
|
+
],
|
|
75
|
+
'@typescript-eslint/no-use-before-define': 'error',
|
|
76
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
77
|
+
'error',
|
|
78
|
+
{
|
|
79
|
+
ignoreParameters: true,
|
|
80
|
+
ignoreProperties: true,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
84
|
+
'import/no-default-export': 'error',
|
|
85
|
+
'import/no-named-as-default': 'error',
|
|
86
|
+
'import/no-named-as-default-member': 'error',
|
|
87
|
+
'import/no-namespace': 'error',
|
|
88
|
+
'simple-import-sort/imports': 'error',
|
|
89
|
+
'simple-import-sort/exports': 'error',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
export const commonIgnores = {
|
|
93
|
+
ignores: ['node_modules', 'dist', '.nuxt', 'coverage', '.output', 'build'],
|
|
94
|
+
};
|
|
95
|
+
export const configFilesOverride = {
|
|
96
|
+
files: ['*.config.{js,ts}'],
|
|
97
|
+
rules: { 'import/no-default-export': 'off' },
|
|
98
|
+
};
|
|
99
|
+
export const typescriptConfigs = [
|
|
100
|
+
eslintJS.configs.recommended,
|
|
101
|
+
...typescriptEslint.configs.recommended,
|
|
102
|
+
...typescriptEslint.configs.strict,
|
|
103
|
+
...typescriptEslint.configs.stylistic,
|
|
104
|
+
];
|
|
105
|
+
export const prettierConfig = eslintConfigPrettier;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import globals from 'globals';
|
|
2
|
+
import typescriptEslint from 'typescript-eslint';
|
|
3
|
+
import { baseConfig, commonIgnores, configFilesOverride, prettierConfig, typescriptConfigs, } from './base';
|
|
4
|
+
export const nodeGlobalsConfig = {
|
|
5
|
+
name: 'node-toolkit/node-globals',
|
|
6
|
+
languageOptions: {
|
|
7
|
+
globals: {
|
|
8
|
+
...globals.node,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default typescriptEslint.config(...typescriptConfigs, nodeGlobalsConfig, baseConfig, prettierConfig, configFilesOverride, commonIgnores);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import typescriptEslint from 'typescript-eslint';
|
|
2
|
+
import { baseConfig, commonIgnores, configFilesOverride, prettierConfig, typescriptConfigs, } from './base';
|
|
3
|
+
import { nodeGlobalsConfig } from './node';
|
|
4
|
+
import { vueFilesConfig } from './vue';
|
|
5
|
+
const nuxtGlobals = {
|
|
6
|
+
name: 'node-toolkit/nuxt-globals',
|
|
7
|
+
languageOptions: {
|
|
8
|
+
globals: {
|
|
9
|
+
ref: 'readonly',
|
|
10
|
+
computed: 'readonly',
|
|
11
|
+
reactive: 'readonly',
|
|
12
|
+
readonly: 'readonly',
|
|
13
|
+
watch: 'readonly',
|
|
14
|
+
watchEffect: 'readonly',
|
|
15
|
+
toRef: 'readonly',
|
|
16
|
+
toRefs: 'readonly',
|
|
17
|
+
isRef: 'readonly',
|
|
18
|
+
unref: 'readonly',
|
|
19
|
+
shallowRef: 'readonly',
|
|
20
|
+
shallowReactive: 'readonly',
|
|
21
|
+
onMounted: 'readonly',
|
|
22
|
+
onBeforeMount: 'readonly',
|
|
23
|
+
onBeforeUnmount: 'readonly',
|
|
24
|
+
onUnmounted: 'readonly',
|
|
25
|
+
onUpdated: 'readonly',
|
|
26
|
+
onBeforeUpdate: 'readonly',
|
|
27
|
+
nextTick: 'readonly',
|
|
28
|
+
provide: 'readonly',
|
|
29
|
+
inject: 'readonly',
|
|
30
|
+
useRouter: 'readonly',
|
|
31
|
+
useRoute: 'readonly',
|
|
32
|
+
useFetch: 'readonly',
|
|
33
|
+
useAsyncData: 'readonly',
|
|
34
|
+
useLazyFetch: 'readonly',
|
|
35
|
+
useLazyAsyncData: 'readonly',
|
|
36
|
+
useState: 'readonly',
|
|
37
|
+
useCookie: 'readonly',
|
|
38
|
+
useRequestHeaders: 'readonly',
|
|
39
|
+
useRequestEvent: 'readonly',
|
|
40
|
+
useRuntimeConfig: 'readonly',
|
|
41
|
+
useAppConfig: 'readonly',
|
|
42
|
+
useHead: 'readonly',
|
|
43
|
+
useSeoMeta: 'readonly',
|
|
44
|
+
useNuxtApp: 'readonly',
|
|
45
|
+
useError: 'readonly',
|
|
46
|
+
navigateTo: 'readonly',
|
|
47
|
+
abortNavigation: 'readonly',
|
|
48
|
+
definePageMeta: 'readonly',
|
|
49
|
+
defineNuxtComponent: 'readonly',
|
|
50
|
+
defineNuxtPlugin: 'readonly',
|
|
51
|
+
defineNuxtRouteMiddleware: 'readonly',
|
|
52
|
+
createError: 'readonly',
|
|
53
|
+
showError: 'readonly',
|
|
54
|
+
clearError: 'readonly',
|
|
55
|
+
reloadNuxtApp: 'readonly',
|
|
56
|
+
refreshNuxtData: 'readonly',
|
|
57
|
+
callOnce: 'readonly',
|
|
58
|
+
prefetchComponents: 'readonly',
|
|
59
|
+
preloadComponents: 'readonly',
|
|
60
|
+
preloadRouteComponents: 'readonly',
|
|
61
|
+
addRouteMiddleware: 'readonly',
|
|
62
|
+
$fetch: 'readonly',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
const nuxtVueOverride = {
|
|
67
|
+
name: 'node-toolkit/nuxt-vue-override',
|
|
68
|
+
files: ['**/*.vue'],
|
|
69
|
+
rules: {
|
|
70
|
+
'vue/multi-word-component-names': 'off',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
export default typescriptEslint.config(...typescriptConfigs, nodeGlobalsConfig, nuxtGlobals, baseConfig, vueFilesConfig, nuxtVueOverride, prettierConfig, configFilesOverride, commonIgnores);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import eslintPluginVue from 'eslint-plugin-vue';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import typescriptEslint from 'typescript-eslint';
|
|
4
|
+
import { baseConfig, commonIgnores, configFilesOverride, prettierConfig, typescriptConfigs, } from './base';
|
|
5
|
+
import { nodeGlobalsConfig } from './node';
|
|
6
|
+
export const vueFilesConfig = {
|
|
7
|
+
name: 'node-toolkit/vue',
|
|
8
|
+
extends: [...eslintPluginVue.configs['flat/recommended']],
|
|
9
|
+
files: ['**/*.vue'],
|
|
10
|
+
languageOptions: {
|
|
11
|
+
ecmaVersion: 'latest',
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
globals: globals.browser,
|
|
14
|
+
parserOptions: {
|
|
15
|
+
parser: typescriptEslint.parser,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
'vue/component-name-in-template-casing': [
|
|
20
|
+
'error',
|
|
21
|
+
'PascalCase',
|
|
22
|
+
{
|
|
23
|
+
registeredComponentsOnly: false,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export default typescriptEslint.config(...typescriptConfigs, nodeGlobalsConfig, baseConfig, vueFilesConfig, prettierConfig, configFilesOverride, commonIgnores);
|
package/dist/eslint.config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("typescript-eslint").FlatConfig.ConfigArray;
|
|
2
2
|
export default _default;
|
package/dist/eslint.config.js
CHANGED
|
@@ -1,124 +1,10 @@
|
|
|
1
|
-
import eslintJS from '@eslint/js';
|
|
2
|
-
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
3
|
-
import importPlugin from 'eslint-plugin-import';
|
|
4
|
-
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
5
|
-
import eslintPluginVue from 'eslint-plugin-vue';
|
|
6
|
-
import globals from 'globals';
|
|
7
|
-
import tsEslint from 'typescript-eslint';
|
|
8
1
|
import typescriptEslint from 'typescript-eslint';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
files: ['**/*.{ts,vue}'],
|
|
13
|
-
languageOptions: {
|
|
14
|
-
ecmaVersion: 'latest',
|
|
15
|
-
sourceType: 'module',
|
|
16
|
-
globals: globals.browser,
|
|
17
|
-
parserOptions: {
|
|
18
|
-
parser: typescriptEslint.parser,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
'vue/component-name-in-template-casing': [
|
|
23
|
-
'error',
|
|
24
|
-
'PascalCase',
|
|
25
|
-
{
|
|
26
|
-
registeredComponentsOnly: false,
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
const defaultConfig = {
|
|
32
|
-
name: 'eslint-config-node-tools/default',
|
|
33
|
-
languageOptions: {
|
|
34
|
-
globals: {
|
|
35
|
-
...globals.node,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
rules: {},
|
|
39
|
-
};
|
|
40
|
-
const customConfig = {
|
|
41
|
-
name: 'eslint-config-node-tools/custom-config',
|
|
42
|
-
plugins: {
|
|
43
|
-
import: importPlugin,
|
|
44
|
-
'simple-import-sort': simpleImportSort,
|
|
45
|
-
},
|
|
2
|
+
import nodeConfig from './configs/eslint/node';
|
|
3
|
+
const configsOverride = {
|
|
4
|
+
files: ['configs/**/*.ts', 'eslint.config.ts'],
|
|
46
5
|
rules: {
|
|
47
|
-
|
|
48
|
-
'
|
|
49
|
-
'no-useless-rename': 'error',
|
|
50
|
-
'no-useless-constructor': 'error',
|
|
51
|
-
'no-console': 'error',
|
|
52
|
-
'no-debugger': 'error',
|
|
53
|
-
'no-throw-literal': 'error',
|
|
54
|
-
'no-unused-expressions': 'error',
|
|
55
|
-
'no-var': 'error',
|
|
56
|
-
'no-redeclare': 'error',
|
|
57
|
-
'no-const-assign': 'error',
|
|
58
|
-
'no-restricted-imports': [
|
|
59
|
-
'error',
|
|
60
|
-
{
|
|
61
|
-
patterns: [
|
|
62
|
-
{
|
|
63
|
-
group: ['../*', './*'],
|
|
64
|
-
message: 'Relative imports are not allowed. Use absolute imports instead with @/.',
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
'sort-imports': 'off',
|
|
70
|
-
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
71
|
-
'@typescript-eslint/no-explicit-any': ['error', { fixToUnknown: true }],
|
|
72
|
-
'@typescript-eslint/consistent-type-imports': [
|
|
73
|
-
'error',
|
|
74
|
-
{ prefer: 'type-imports' },
|
|
75
|
-
],
|
|
76
|
-
'@typescript-eslint/no-unused-vars': [
|
|
77
|
-
'error',
|
|
78
|
-
{
|
|
79
|
-
argsIgnorePattern: '^_',
|
|
80
|
-
varsIgnorePattern: '^_',
|
|
81
|
-
caughtErrorsIgnorePattern: '^_',
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
'@typescript-eslint/naming-convention': [
|
|
85
|
-
'error',
|
|
86
|
-
{
|
|
87
|
-
selector: 'import',
|
|
88
|
-
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
89
|
-
},
|
|
90
|
-
{ selector: 'class', format: ['PascalCase'] },
|
|
91
|
-
{
|
|
92
|
-
selector: 'variable',
|
|
93
|
-
modifiers: ['const'],
|
|
94
|
-
format: ['camelCase', 'UPPER_CASE'],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
selector: 'typeParameter',
|
|
98
|
-
format: ['PascalCase'],
|
|
99
|
-
},
|
|
100
|
-
{ selector: 'enum', format: ['PascalCase'] },
|
|
101
|
-
],
|
|
102
|
-
'@typescript-eslint/no-use-before-define': 'error',
|
|
103
|
-
'@typescript-eslint/no-inferrable-types': [
|
|
104
|
-
'error',
|
|
105
|
-
{
|
|
106
|
-
ignoreParameters: true,
|
|
107
|
-
ignoreProperties: true,
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
111
|
-
'import/no-default-export': 'error',
|
|
112
|
-
'import/no-named-as-default': 'error',
|
|
113
|
-
'import/no-named-as-default-member': 'error',
|
|
114
|
-
'import/no-namespace': 'error',
|
|
115
|
-
'simple-import-sort/imports': 'error',
|
|
116
|
-
'simple-import-sort/exports': 'error',
|
|
6
|
+
'no-restricted-imports': 'off',
|
|
7
|
+
'import/no-default-export': 'off',
|
|
117
8
|
},
|
|
118
9
|
};
|
|
119
|
-
export default
|
|
120
|
-
files: ['*.config.{js,ts}'],
|
|
121
|
-
rules: { 'import/no-default-export': 'off' },
|
|
122
|
-
}, {
|
|
123
|
-
ignores: ['node_modules', 'dist', '.nuxt', 'coverage', '.output'],
|
|
124
|
-
});
|
|
10
|
+
export default typescriptEslint.config(...nodeConfig, configsOverride);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vfourny/node-toolkit",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Toolkit for Node.js projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/libs/index.js",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"format": "prettier --write .",
|
|
14
14
|
"format:check": "prettier --check .",
|
|
15
15
|
"type-check": "tsc --noEmit",
|
|
16
|
+
"test": "vitest run",
|
|
17
|
+
"test:watch": "vitest",
|
|
18
|
+
"test:ui": "vitest --ui",
|
|
19
|
+
"test:coverage": "vitest run --coverage",
|
|
16
20
|
"prepare": "husky"
|
|
17
21
|
},
|
|
18
22
|
"files": [
|
|
@@ -21,8 +25,24 @@
|
|
|
21
25
|
],
|
|
22
26
|
"exports": {
|
|
23
27
|
"./eslint": {
|
|
24
|
-
"types": "./dist/eslint.
|
|
25
|
-
"default": "./dist/eslint.
|
|
28
|
+
"types": "./dist/configs/eslint/index.d.ts",
|
|
29
|
+
"default": "./dist/configs/eslint/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./eslint/base": {
|
|
32
|
+
"types": "./dist/configs/eslint/base.d.ts",
|
|
33
|
+
"default": "./dist/configs/eslint/base.js"
|
|
34
|
+
},
|
|
35
|
+
"./eslint/node": {
|
|
36
|
+
"types": "./dist/configs/eslint/node.d.ts",
|
|
37
|
+
"default": "./dist/configs/eslint/node.js"
|
|
38
|
+
},
|
|
39
|
+
"./eslint/vue": {
|
|
40
|
+
"types": "./dist/configs/eslint/vue.d.ts",
|
|
41
|
+
"default": "./dist/configs/eslint/vue.js"
|
|
42
|
+
},
|
|
43
|
+
"./eslint/nuxt": {
|
|
44
|
+
"types": "./dist/configs/eslint/nuxt.d.ts",
|
|
45
|
+
"default": "./dist/configs/eslint/nuxt.js"
|
|
26
46
|
},
|
|
27
47
|
"./prettier": {
|
|
28
48
|
"types": "./dist/prettier.config.d.ts",
|
|
@@ -50,34 +70,37 @@
|
|
|
50
70
|
"author": "Valentin Fourny",
|
|
51
71
|
"license": "ISC",
|
|
52
72
|
"dependencies": {
|
|
53
|
-
"@commitlint/config-angular": "^
|
|
73
|
+
"@commitlint/config-angular": "^20.2.0",
|
|
54
74
|
"@semantic-release/changelog": "^6.0.3",
|
|
55
75
|
"@semantic-release/git": "^10.0.1",
|
|
56
|
-
"eslint-config-prettier": "^10.
|
|
76
|
+
"eslint-config-prettier": "^10.1.8",
|
|
77
|
+
"eslint-import-resolver-typescript": "^4.0.0",
|
|
57
78
|
"eslint-plugin-import": "^2.32.0",
|
|
58
79
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
59
|
-
"eslint-plugin-vue": "^
|
|
60
|
-
"globals": "^
|
|
61
|
-
"typescript-eslint": "^8.
|
|
80
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
81
|
+
"globals": "^16.5.0",
|
|
82
|
+
"typescript-eslint": "^8.50.0"
|
|
62
83
|
},
|
|
63
84
|
"devDependencies": {
|
|
64
|
-
"@commitlint/types": "^
|
|
65
|
-
"@eslint/js": "^9.
|
|
66
|
-
"@types/eslint__js": "^8.42.3",
|
|
85
|
+
"@commitlint/types": "^20.2.0",
|
|
86
|
+
"@eslint/js": "^9.39.2",
|
|
67
87
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
68
|
-
"@types/node": "^
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
88
|
+
"@types/node": "^25.0.3",
|
|
89
|
+
"@vitest/ui": "^4.0.16",
|
|
90
|
+
"commitlint": "^20.2.0",
|
|
91
|
+
"eslint": "^9.39.2",
|
|
92
|
+
"husky": "^9.1.7",
|
|
93
|
+
"prettier": "^3.7.4",
|
|
94
|
+
"semantic-release": "^25.0.0",
|
|
95
|
+
"typescript": "^5.9.3",
|
|
96
|
+
"vitest": "^4.0.16",
|
|
97
|
+
"vue-eslint-parser": "^10.2.0"
|
|
75
98
|
},
|
|
76
99
|
"peerDependencies": {
|
|
77
|
-
"commitlint": "^19.8.0",
|
|
100
|
+
"commitlint": "^19.8.0 || ^20.1.0",
|
|
78
101
|
"eslint": "^9.3.0",
|
|
79
102
|
"prettier": "^3.2.5",
|
|
80
|
-
"semantic-release": "^24.0.0",
|
|
103
|
+
"semantic-release": "^24.0.0 || ^25.0.0",
|
|
81
104
|
"typescript": "^5.5.2"
|
|
82
105
|
},
|
|
83
106
|
"repository": {
|
|
@@ -89,7 +112,7 @@
|
|
|
89
112
|
"registry": "https://registry.npmjs.org/"
|
|
90
113
|
},
|
|
91
114
|
"engines": {
|
|
92
|
-
"node": ">=20.13 <
|
|
115
|
+
"node": ">=20.13 <25",
|
|
93
116
|
"npm": ">= 10"
|
|
94
117
|
}
|
|
95
118
|
}
|