@nitra/eslint-config 3.4.8 → 3.5.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 +1 -1
- package/graphql-eslint-anchor.js +4 -1
- package/index.js +21 -11
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ export default [
|
|
|
79
79
|
|
|
80
80
|
## Що входить у конфіг
|
|
81
81
|
|
|
82
|
-
- Базові правила JS (recommended), JSDoc,
|
|
82
|
+
- Базові правила JS (recommended), JSDoc, **eslint-plugin-import-x** (префікс `import-x/`), Unicorn
|
|
83
83
|
- YAML і Markdown
|
|
84
84
|
- Для **Node**: eslint-plugin-n
|
|
85
85
|
- Для **Vue**: eslint-plugin-vue з правилами атрибутів та порядку
|
package/graphql-eslint-anchor.js
CHANGED
|
@@ -17,6 +17,9 @@ let onDiskConfig
|
|
|
17
17
|
let onDiskConfigLoaded = false
|
|
18
18
|
const RELEVANT_KEYWORDS = ['gql', 'graphql', 'GraphQL']
|
|
19
19
|
|
|
20
|
+
/** Регулярний вираз на рівні модуля для e18e/prefer-static-regex. */
|
|
21
|
+
const VUE_OR_SVELTE_FILE_RE = /\.(vue|svelte)$/
|
|
22
|
+
|
|
20
23
|
/**
|
|
21
24
|
* Шлях для graphql-config: для віртуальних блоків Vue — фізичний .vue, інакше той самий filePath.
|
|
22
25
|
* @param {string} filePath шлях файлу, який обробляє processor
|
|
@@ -86,7 +89,7 @@ ${error.message}`
|
|
|
86
89
|
for (const [i, block] of blocks.entries()) {
|
|
87
90
|
const { lineOffset, offset } = block
|
|
88
91
|
for (const message of messages[i] || []) {
|
|
89
|
-
const isVueOrSvelte =
|
|
92
|
+
const isVueOrSvelte = VUE_OR_SVELTE_FILE_RE.test(filePath)
|
|
90
93
|
if (isVueOrSvelte) {
|
|
91
94
|
delete message.endLine
|
|
92
95
|
delete message.endColumn
|
package/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import e18ePlugin from '@e18e/eslint-plugin'
|
|
1
2
|
import { fixupPluginRules } from '@eslint/compat'
|
|
2
3
|
import js from '@eslint/js'
|
|
3
4
|
import graphqlEslintPlugin from '@graphql-eslint/eslint-plugin'
|
|
4
5
|
import { graphqlCodefileProcessor, graphqlParserWithConfigAnchor } from './graphql-eslint-anchor.js'
|
|
5
6
|
import microsoftSdl from '@microsoft/eslint-plugin-sdl'
|
|
6
|
-
import { flatConfigs as
|
|
7
|
+
import { flatConfigs as importXFlatConfigs } from 'eslint-plugin-import-x'
|
|
7
8
|
import jsdocPlugin from 'eslint-plugin-jsdoc'
|
|
8
9
|
import { configs as jsoncConfigs } from 'eslint-plugin-jsonc'
|
|
9
10
|
import markdownPlugin from 'eslint-plugin-markdown'
|
|
@@ -20,6 +21,10 @@ import globals from 'globals'
|
|
|
20
21
|
/** Glob-патерни файлів для eslint-plugin-unicorn (JS-подібні джерела; без сирих YAML/Markdown). */
|
|
21
22
|
const UNICORN_FILES = ['**/*.{js,mjs,cjs,vue}']
|
|
22
23
|
|
|
24
|
+
/** Пресет recommended `@e18e/eslint-plugin` (flat). */
|
|
25
|
+
// @ts-expect-error типізація плагіна не гарантує `configs.recommended`; у runtime поле є.
|
|
26
|
+
const e18eRecommendedFlat = /** @type {import('eslint').Linter.FlatConfig} */ (e18ePlugin.configs.recommended)
|
|
27
|
+
|
|
23
28
|
/** Віртуальні документи з gql/graphql у .js/.vue (processor); ESLint обробляє їх як окремі `*.graphql` файли. */
|
|
24
29
|
const GRAPHQL_EXTRACTED_DOCUMENT_FILES = ['**/*.graphql']
|
|
25
30
|
|
|
@@ -75,11 +80,11 @@ function flatConfigsWithFiles(configs, files) {
|
|
|
75
80
|
return configs.map(config => ({ ...config, files }))
|
|
76
81
|
}
|
|
77
82
|
|
|
78
|
-
// Перевизначаємо версію EcmaScript на останню
|
|
79
|
-
const
|
|
80
|
-
...
|
|
83
|
+
// Перевизначаємо версію EcmaScript на останню (eslint-plugin-import-x — fork import з flat recommended)
|
|
84
|
+
const importXPluginEcmaLatest = {
|
|
85
|
+
...importXFlatConfigs.recommended,
|
|
81
86
|
languageOptions: {
|
|
82
|
-
...
|
|
87
|
+
...importXFlatConfigs.recommended?.languageOptions,
|
|
83
88
|
ecmaVersion: 'latest'
|
|
84
89
|
}
|
|
85
90
|
}
|
|
@@ -95,14 +100,14 @@ const all = [
|
|
|
95
100
|
...jsoncConfigs['flat/recommended-with-jsonc'],
|
|
96
101
|
// Загальні правила для всіх MD файлів проекту
|
|
97
102
|
...markdownPlugin.configs.recommended,
|
|
98
|
-
// Плагін eslint-plugin-import
|
|
99
|
-
|
|
103
|
+
// Плагін eslint-plugin-import-x (правила з префіксом import-x/)
|
|
104
|
+
importXPluginEcmaLatest,
|
|
100
105
|
{
|
|
101
106
|
rules: {
|
|
102
|
-
'import/no-unresolved': 'off', // не працює з monorepo та #alias
|
|
103
|
-
'import/newline-after-import': ['error', { count: 1 }],
|
|
104
|
-
// 'import/order': ['error', { warnOnUnassignedImports: true }],
|
|
105
|
-
'import/no-useless-path-segments': ['error', { noUselessIndex: false }]
|
|
107
|
+
'import-x/no-unresolved': 'off', // не працює з monorepo та #alias
|
|
108
|
+
'import-x/newline-after-import': ['error', { count: 1 }],
|
|
109
|
+
// 'import-x/order': ['error', { warnOnUnassignedImports: true }],
|
|
110
|
+
'import-x/no-useless-path-segments': ['error', { noUselessIndex: false }]
|
|
106
111
|
}
|
|
107
112
|
},
|
|
108
113
|
// Загальні правила для всіх js файлів проекту
|
|
@@ -164,6 +169,11 @@ const all = [
|
|
|
164
169
|
'security/detect-unsafe-regex': 'off'
|
|
165
170
|
}
|
|
166
171
|
},
|
|
172
|
+
// @e18e/eslint-plugin — recommended (modernization + module replacements + performance)
|
|
173
|
+
{
|
|
174
|
+
files: UNICORN_FILES,
|
|
175
|
+
...e18eRecommendedFlat
|
|
176
|
+
},
|
|
167
177
|
// @microsoft/eslint-plugin-sdl — common SDL (без TypeScript/React/Angular; узгоджено з UNICORN_FILES)
|
|
168
178
|
...flatConfigsWithFiles(microsoftSdl.configs.common, UNICORN_FILES)
|
|
169
179
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitra/eslint-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "An ESLint shareable config for projects using Vue and Node",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"types": "./index.d.ts",
|
|
23
23
|
"exports": "./index.js",
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@e18e/eslint-plugin": "^0.3.0",
|
|
25
26
|
"@eslint/compat": "^2.0.5",
|
|
26
27
|
"@eslint/js": "^10.0.1",
|
|
27
28
|
"@graphql-eslint/eslint-plugin": "^4.4.0",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"@microsoft/eslint-plugin-sdl": "^1.1.0",
|
|
31
32
|
"eslint": "^10.2.0",
|
|
32
33
|
"eslint-merge-processors": "^2.0.0",
|
|
33
|
-
"eslint-plugin-import": "^
|
|
34
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
34
35
|
"eslint-plugin-jsdoc": "^62.9.0",
|
|
35
36
|
"eslint-plugin-jsonc": "^3.1.2",
|
|
36
37
|
"eslint-plugin-markdown": "^5.1.0",
|