voss-node-configs 1.0.18 → 1.0.20
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/base.js +59 -0
- package/node.js +34 -0
- package/package.json +8 -4
package/base.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import typescript from '@typescript-eslint/eslint-plugin';
|
|
3
|
+
import typescriptParser from '@typescript-eslint/parser';
|
|
4
|
+
import prettierPlugin from 'eslint-plugin-prettier';
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
js.configs.recommended,
|
|
8
|
+
{
|
|
9
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
|
10
|
+
languageOptions: {
|
|
11
|
+
parser: typescriptParser,
|
|
12
|
+
parserOptions: {
|
|
13
|
+
ecmaVersion: 'latest',
|
|
14
|
+
sourceType: 'module',
|
|
15
|
+
project: './tsconfig.json',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
plugins: {
|
|
19
|
+
'@typescript-eslint': typescript,
|
|
20
|
+
prettier: prettierPlugin,
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
// Prettier integration
|
|
24
|
+
'prettier/prettier': 'error',
|
|
25
|
+
|
|
26
|
+
// Base rules for all projects
|
|
27
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
28
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
29
|
+
'@typescript-eslint/prefer-const': 'error',
|
|
30
|
+
'@typescript-eslint/no-var-requires': 'error',
|
|
31
|
+
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
32
|
+
'prefer-const': 'error',
|
|
33
|
+
'no-var': 'error',
|
|
34
|
+
'no-console': 'off', // Allow console by default, can be overridden
|
|
35
|
+
'no-debugger': 'error',
|
|
36
|
+
'no-duplicate-imports': 'error',
|
|
37
|
+
'no-unreachable': 'error',
|
|
38
|
+
'prefer-arrow-callback': 'error',
|
|
39
|
+
'prefer-template': 'error',
|
|
40
|
+
'template-curly-spacing': 'error',
|
|
41
|
+
'object-curly-spacing': ['error', 'always'],
|
|
42
|
+
'array-bracket-spacing': ['error', 'never'],
|
|
43
|
+
'comma-dangle': ['error', 'always-multiline'],
|
|
44
|
+
'semi': ['error', 'always'],
|
|
45
|
+
'quotes': ['error', 'single', { 'avoidEscape': true }],
|
|
46
|
+
|
|
47
|
+
// General code quality
|
|
48
|
+
'consistent-return': 'off',
|
|
49
|
+
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
50
|
+
'no-plusplus': 'off',
|
|
51
|
+
'no-await-in-loop': 'off',
|
|
52
|
+
'no-multi-assign': 'off',
|
|
53
|
+
'no-underscore-dangle': 'off',
|
|
54
|
+
'no-use-before-define': ['error', { functions: false, classes: true }],
|
|
55
|
+
'object-shorthand': ['error', 'properties'],
|
|
56
|
+
'prefer-destructuring': 'off',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
];
|
package/node.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import baseConfig from './base.js';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
...baseConfig,
|
|
5
|
+
{
|
|
6
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
|
7
|
+
languageOptions: {
|
|
8
|
+
globals: {
|
|
9
|
+
node: 'readonly',
|
|
10
|
+
process: 'readonly',
|
|
11
|
+
Buffer: 'readonly',
|
|
12
|
+
__dirname: 'readonly',
|
|
13
|
+
__filename: 'readonly',
|
|
14
|
+
global: 'readonly',
|
|
15
|
+
console: 'readonly',
|
|
16
|
+
},
|
|
17
|
+
ecmaVersion: 2022,
|
|
18
|
+
sourceType: 'module',
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
// Node.js specific rules
|
|
22
|
+
'@typescript-eslint/no-require-imports': 'off', // Allow require() in Node.js
|
|
23
|
+
'global-require': 'off', // Allow require() anywhere in Node.js
|
|
24
|
+
'no-process-exit': 'error', // Prevent process.exit() usage
|
|
25
|
+
'no-sync': 'warn', // Warn about synchronous methods
|
|
26
|
+
'no-buffer-constructor': 'error', // Use Buffer.from() instead of new Buffer()
|
|
27
|
+
'prefer-global/buffer': 'error', // Prefer global Buffer
|
|
28
|
+
'prefer-global/console': 'error', // Prefer global console
|
|
29
|
+
'prefer-global/process': 'error', // Prefer global process
|
|
30
|
+
'prefer-global/url-search-params': 'error', // Prefer global URLSearchParams
|
|
31
|
+
'prefer-global/url': 'error', // Prefer global URL
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "voss-node-configs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "Shared TypeScript and ESLint configs for Node.js projects",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./tsconfig.base": "./tsconfig.base.json",
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
"./tsconfig.front-end.dev": "./tsconfig.front-end.dev.json",
|
|
11
11
|
"./tsconfig.front-end.build": "./tsconfig.front-end.build.json",
|
|
12
12
|
"./tsconfig.front-end.node": "./tsconfig.front-end.node.json",
|
|
13
|
-
"./
|
|
14
|
-
"./
|
|
13
|
+
"./eslint-base": "./base.js",
|
|
14
|
+
"./eslint-front-end": "./front-end.js",
|
|
15
|
+
"./eslint-back-end": "./back-end.js",
|
|
16
|
+
"./eslint-node": "./node.js"
|
|
15
17
|
},
|
|
16
18
|
"files": [
|
|
17
19
|
"tsconfig.base.json",
|
|
@@ -21,8 +23,10 @@
|
|
|
21
23
|
"tsconfig.front-end.build.json",
|
|
22
24
|
"tsconfig.front-end.dev.json",
|
|
23
25
|
"tsconfig.front-end.node.json",
|
|
26
|
+
"base.js",
|
|
24
27
|
"front-end.js",
|
|
25
|
-
"back-end.js"
|
|
28
|
+
"back-end.js",
|
|
29
|
+
"node.js"
|
|
26
30
|
],
|
|
27
31
|
"devDependencies": {
|
|
28
32
|
"@eslint/js": "^9.0.0",
|