@itstandu/code-style 0.1.3 → 0.1.5

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/eslint/base.js CHANGED
@@ -1,4 +1,4 @@
1
- const prettierConfig = require('eslint-config-prettier')
1
+ const prettierConfig = require('eslint-config-prettier');
2
2
 
3
3
  module.exports = {
4
4
  ignores: [
@@ -60,7 +60,14 @@ module.exports = {
60
60
  'simple-import-sort/imports': [
61
61
  'error',
62
62
  {
63
- groups: [['^\\u0000'], ['^node:'], ['^@?\\w'], ['^@/'], ['^\\.\\.'], ['^\\.']],
63
+ groups: [
64
+ ['^\\u0000'],
65
+ ['^node:'],
66
+ ['^@?\\w'],
67
+ ['^@/'],
68
+ ['^\\.\\.'],
69
+ ['^\\.'],
70
+ ],
64
71
  },
65
72
  ],
66
73
  'simple-import-sort/exports': 'error',
@@ -77,12 +84,22 @@ module.exports = {
77
84
  ],
78
85
  'no-unused-vars': 'off',
79
86
 
80
- // STRICT: No eslint-disable comments allowed
81
- 'no-warning-comments': [
87
+ // STRICT: Dangerous patterns prevention
88
+ // Note: To enforce no eslint-disable comments, add @eslint-community/eslint-plugin-eslint-comments
89
+ 'no-restricted-syntax': [
82
90
  'error',
83
91
  {
84
- terms: ['eslint-disable', 'eslint-disable-line', 'eslint-disable-next-line'],
85
- location: 'anywhere',
92
+ selector: 'ForInStatement',
93
+ message:
94
+ 'for...in loops iterate over the entire prototype chain. Use Object.keys() or for...of instead.',
95
+ },
96
+ {
97
+ selector: 'LabeledStatement',
98
+ message: 'Labels are rarely needed. Consider refactoring.',
99
+ },
100
+ {
101
+ selector: 'WithStatement',
102
+ message: '`with` is disallowed in strict mode.',
86
103
  },
87
104
  ],
88
105
 
@@ -91,4 +108,4 @@ module.exports = {
91
108
  'import/newline-after-import': 'error',
92
109
  'import/no-duplicates': 'error',
93
110
  },
94
- }
111
+ };
package/eslint/nest.js CHANGED
@@ -1,4 +1,4 @@
1
- const node = require('./node')
1
+ const node = require('./node');
2
2
 
3
3
  module.exports = {
4
4
  ...node,
@@ -22,4 +22,4 @@ module.exports = {
22
22
  // Allow any for DTOs and decorators
23
23
  '@typescript-eslint/no-explicit-any': 'off',
24
24
  },
25
- }
25
+ };
package/eslint/react.js CHANGED
@@ -1,4 +1,4 @@
1
- const ts = require('./typescript')
1
+ const ts = require('./typescript');
2
2
 
3
3
  module.exports = {
4
4
  ...ts,
@@ -45,6 +45,7 @@ module.exports = {
45
45
  'react/no-direct-mutation-state': 'error',
46
46
  'react/no-unescaped-entities': 'off',
47
47
  'react/no-unknown-property': 'error',
48
+ 'react/no-unstable-nested-components': ['warn', { allowAsProps: true }],
48
49
  'react/self-closing-comp': 'off',
49
50
 
50
51
  'react/jsx-boolean-value': 'off',
@@ -98,4 +99,4 @@ module.exports = {
98
99
  'jsx-a11y/scope': 'warn',
99
100
  'jsx-a11y/tabindex-no-positive': 'warn',
100
101
  },
101
- }
102
+ };
@@ -1,4 +1,4 @@
1
- const base = require('./base')
1
+ const base = require('./base');
2
2
 
3
3
  module.exports = {
4
4
  ...base,
@@ -58,13 +58,22 @@ module.exports = {
58
58
  '@typescript-eslint/no-shadow': 'warn',
59
59
  '@typescript-eslint/no-require-imports': 'warn',
60
60
  '@typescript-eslint/ban-ts-comment': [
61
- 'warn',
61
+ 'error',
62
62
  {
63
63
  'ts-expect-error': 'allow-with-description',
64
- 'ts-ignore': true,
64
+ 'ts-ignore': 'allow-with-description',
65
65
  'ts-nocheck': true,
66
66
  'ts-check': false,
67
+ minimumDescriptionLength: 10,
67
68
  },
68
69
  ],
70
+
71
+ // Strict: Prevent common mistakes
72
+ '@typescript-eslint/no-array-delete': 'error',
73
+ '@typescript-eslint/no-duplicate-enum-values': 'error',
74
+ '@typescript-eslint/no-duplicate-type-constituents': 'warn',
75
+ '@typescript-eslint/no-redundant-type-constituents': 'warn',
76
+ '@typescript-eslint/no-unsafe-declaration-merging': 'error',
77
+ '@typescript-eslint/no-useless-empty-export': 'warn',
69
78
  },
70
- }
79
+ };
package/eslint/vue.js CHANGED
@@ -1,32 +1,24 @@
1
- const base = require('./base')
1
+ const ts = require('./typescript');
2
2
 
3
3
  module.exports = {
4
- ...base,
4
+ ...ts,
5
5
  languageOptions: {
6
- ...base.languageOptions,
6
+ ...ts.languageOptions,
7
7
  parser: require('vue-eslint-parser'),
8
8
  parserOptions: {
9
9
  parser: require('@typescript-eslint/parser'),
10
10
  ecmaVersion: 'latest',
11
11
  sourceType: 'module',
12
12
  project: true,
13
+ extraFileExtensions: ['.vue'],
13
14
  },
14
15
  },
15
16
  plugins: {
16
- ...base.plugins,
17
+ ...ts.plugins,
17
18
  vue: require('eslint-plugin-vue'),
18
- '@typescript-eslint': require('@typescript-eslint/eslint-plugin'),
19
19
  },
20
20
  rules: {
21
- ...base.rules,
22
- 'no-unused-vars': 'off',
23
- '@typescript-eslint/no-unused-vars': 'off',
24
- '@typescript-eslint/no-floating-promises': 'error',
25
- '@typescript-eslint/no-misused-promises': 'error',
26
- '@typescript-eslint/consistent-type-imports': [
27
- 'error',
28
- { prefer: 'type-imports', fixStyle: 'inline-type-imports' },
29
- ],
21
+ ...ts.rules,
30
22
 
31
23
  'vue/component-name-in-template-casing': ['warn', 'PascalCase'],
32
24
  'vue/component-definition-name-casing': ['warn', 'PascalCase'],
@@ -98,4 +90,4 @@ module.exports = {
98
90
  'vue/valid-v-slot': 'error',
99
91
  'vue/valid-v-text': 'error',
100
92
  },
101
- }
93
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itstandu/code-style",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Production-ready shared ESLint + Prettier configuration for JavaScript and TypeScript projects",
5
5
  "type": "commonjs",
6
6
  "main": "index.js",