@nitra/eslint-config 3.6.8 → 3.6.10
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/index.js +31 -3
- package/package.json +7 -6
package/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import jsdocPlugin from 'eslint-plugin-jsdoc'
|
|
|
9
9
|
import { configs as jsoncConfigs } from 'eslint-plugin-jsonc'
|
|
10
10
|
import markdownPlugin from 'eslint-plugin-markdown'
|
|
11
11
|
import nodePlugin from 'eslint-plugin-n'
|
|
12
|
+
import noUnsanitized from 'eslint-plugin-no-unsanitized'
|
|
12
13
|
import oxlint from 'eslint-plugin-oxlint'
|
|
13
14
|
import securityPlugin from 'eslint-plugin-security'
|
|
14
15
|
import sonarjsPlugin from 'eslint-plugin-sonarjs'
|
|
@@ -62,7 +63,7 @@ const GRAPHQL_EXTRACTED_DOCUMENT_FILES = [
|
|
|
62
63
|
]
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
|
-
* Обгортає правило graphql-eslint і логує runtime-падіння visitor callbacks, не змінюючи поведінку (після логу помилка
|
|
66
|
+
* Обгортає правило graphql-eslint і логує runtime-падіння visitor callbacks, не змінюючи поведінку (після логу помилка знову викидається).
|
|
66
67
|
* @param {import('eslint').Rule.RuleModule} ruleImpl оригінальна імплементація правила
|
|
67
68
|
* @param {string} ruleName ім'я правила для debug payload
|
|
68
69
|
* @returns {import('eslint').Rule.RuleModule} обгорнуте правило з runtime-логуванням
|
|
@@ -91,7 +92,7 @@ function instrumentGraphqlRuleForDebug(ruleImpl, ruleName) {
|
|
|
91
92
|
ruleName === '@graphql-eslint/no-deprecated' &&
|
|
92
93
|
selector === 'ObjectValue' &&
|
|
93
94
|
error instanceof TypeError &&
|
|
94
|
-
error.message.includes(
|
|
95
|
+
error.message.includes('deprecationReason')
|
|
95
96
|
if (knownNoDeprecatedCrash) {
|
|
96
97
|
return
|
|
97
98
|
}
|
|
@@ -115,6 +116,30 @@ const graphqlEslintPluginWithDebug = {
|
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
|
|
119
|
+
/**
|
|
120
|
+
* `@graphql-eslint/naming-convention` з operations-recommended плюс сумісність із Hasura:
|
|
121
|
+
* аргументи на кшталт `_set`, `_eq` починаються з символу підкреслення — без `allowLeadingUnderscore`
|
|
122
|
+
* правило глобально лає будь-який `Name`, що починається з `_` (не лише camelCase для змінних).
|
|
123
|
+
* @see https://the-guild.dev/graphql/eslint/rules/naming-convention
|
|
124
|
+
*/
|
|
125
|
+
const graphqlNamingConventionHasuraFriendly = [
|
|
126
|
+
'error',
|
|
127
|
+
{
|
|
128
|
+
allowLeadingUnderscore: true,
|
|
129
|
+
VariableDefinition: 'camelCase',
|
|
130
|
+
OperationDefinition: {
|
|
131
|
+
style: 'PascalCase',
|
|
132
|
+
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
|
|
133
|
+
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription']
|
|
134
|
+
},
|
|
135
|
+
FragmentDefinition: {
|
|
136
|
+
style: 'PascalCase',
|
|
137
|
+
forbiddenPrefixes: ['Fragment'],
|
|
138
|
+
forbiddenSuffixes: ['Fragment']
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
|
|
118
143
|
/**
|
|
119
144
|
* Правила для витягнутих GraphQL-блоків: пресет operations-recommended (поля, типи, змінні).
|
|
120
145
|
* Схема та documents підтягуються через graphql-config (файл налаштувань у корені пакета з операціями, зазвичай YAML).
|
|
@@ -131,6 +156,7 @@ const graphqlExtractedDocumentLint = {
|
|
|
131
156
|
},
|
|
132
157
|
rules: {
|
|
133
158
|
...graphqlEslintPlugin.configs['flat/operations-recommended'].rules,
|
|
159
|
+
'@graphql-eslint/naming-convention': graphqlNamingConventionHasuraFriendly,
|
|
134
160
|
'@graphql-eslint/no-deprecated': 'error'
|
|
135
161
|
}
|
|
136
162
|
}
|
|
@@ -259,6 +285,8 @@ const all = [
|
|
|
259
285
|
'security/detect-unsafe-regex': 'off'
|
|
260
286
|
}
|
|
261
287
|
},
|
|
288
|
+
// eslint-plugin-no-unsanitized — innerHTML / insertAdjacentHTML тощо без санітизації (Mozilla; лише JS-подібні файли)
|
|
289
|
+
{ ...noUnsanitized.configs.recommended, files: UNICORN_FILES },
|
|
262
290
|
// eslint-plugin-sonarjs — recommended (bugs, complexity, duplicates; лише JS-подібні файли)
|
|
263
291
|
{ ...sonarjsPlugin.configs.recommended, files: UNICORN_FILES },
|
|
264
292
|
/**
|
|
@@ -311,7 +339,7 @@ const vueVite = [
|
|
|
311
339
|
]
|
|
312
340
|
|
|
313
341
|
/**
|
|
314
|
-
*
|
|
342
|
+
* Глобальні змінні для типового Vite + auto-import: Composition API, vue-router, Quasar, пакет vue-apollo-composable.
|
|
315
343
|
* У пакеті `globals` ключ `vue` містить лише макроси `<script setup>` (`defineProps` тощо), без `onMounted` /
|
|
316
344
|
* `createApp` / `useRouter` — без цього списку `no-undef` хибно спрацьовує у `.vue` і `.js` під директоріями Vue.
|
|
317
345
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitra/eslint-config",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.10",
|
|
4
4
|
"description": "An ESLint shareable config for projects using Vue and Node",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@eslint/compat": "^2.0.5",
|
|
27
27
|
"@eslint/js": "^10.0.1",
|
|
28
28
|
"@graphql-eslint/eslint-plugin": "^4.4.0",
|
|
29
|
-
"@graphql-tools/graphql-tag-pluck": "^8.3.
|
|
30
|
-
"@graphql-tools/utils": "^
|
|
29
|
+
"@graphql-tools/graphql-tag-pluck": "^8.3.30",
|
|
30
|
+
"@graphql-tools/utils": "^11.0.1",
|
|
31
31
|
"@microsoft/eslint-plugin-sdl": "^1.1.0",
|
|
32
32
|
"eslint": "^10.2.0",
|
|
33
33
|
"eslint-merge-processors": "^2.0.0",
|
|
@@ -36,15 +36,16 @@
|
|
|
36
36
|
"eslint-plugin-jsonc": "^3.1.2",
|
|
37
37
|
"eslint-plugin-markdown": "^5.1.0",
|
|
38
38
|
"eslint-plugin-n": "^17.24.0",
|
|
39
|
-
"eslint-plugin-
|
|
39
|
+
"eslint-plugin-no-unsanitized": "^4.1.5",
|
|
40
|
+
"eslint-plugin-oxlint": "^1.60.0",
|
|
40
41
|
"eslint-plugin-security": "^4.0.0",
|
|
41
|
-
"eslint-plugin-sonarjs": "^4.0.
|
|
42
|
+
"eslint-plugin-sonarjs": "^4.0.3",
|
|
42
43
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
43
44
|
"eslint-plugin-vue": "^10.8.0",
|
|
44
45
|
"eslint-plugin-yml": "^3.3.1",
|
|
45
46
|
"eslint-processor-vue-blocks": "^2.0.0",
|
|
46
47
|
"globals": "^17.5.0",
|
|
47
|
-
"graphql": "^16.
|
|
48
|
+
"graphql": "^16.13.2",
|
|
48
49
|
"vue-eslint-parser": "^10.4.0"
|
|
49
50
|
},
|
|
50
51
|
"engines": {
|