@nitra/eslint-config 3.6.10 → 3.6.12
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 +18 -5
- package/package.json +4 -4
- package/types/graphql-eslint-anchor.d.ts +42 -0
- /package/{index.d.ts → types/index.d.ts} +0 -0
package/index.js
CHANGED
|
@@ -30,6 +30,12 @@ const UNICORN_FILES = ['**/*.{js,mjs,cjs,vue}']
|
|
|
30
30
|
/** Узгоджені опції `no-unused-vars` для `.js` і Vue SFC (`eslint-plugin-oxlint` не вимикає це правило для `.vue`, тож oxlint CLI його там не покриває). */
|
|
31
31
|
const NO_UNUSED_VARS_RULE = ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }]
|
|
32
32
|
|
|
33
|
+
/** Правила з `eslint:recommended` + `no-unused-vars` для js/mjs/cjs (однаковий набір; `sourceType` задається в окремих блоках за розширенням). */
|
|
34
|
+
const ESLINT_RECOMMENDED_JS_LIKE_RULES = {
|
|
35
|
+
...js.configs.recommended.rules,
|
|
36
|
+
'no-unused-vars': NO_UNUSED_VARS_RULE
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
/**
|
|
34
40
|
* Частина ядра `eslint:recommended`, яку не вимикає `eslint-plugin-oxlint` flat/recommended (oxlint не заявляє заміну
|
|
35
41
|
* цих правил у ESLint) і яка не ввімкнена в oxlint за кореневим `.oxlintrc.json` — для `<script>` у `.vue` їх
|
|
@@ -229,15 +235,20 @@ const all = [
|
|
|
229
235
|
// Загальні правила для всіх js файлів проекту
|
|
230
236
|
jsdocPlugin.configs['flat/recommended'],
|
|
231
237
|
{
|
|
232
|
-
files: ['**/*.js'],
|
|
238
|
+
files: ['**/*.{js,mjs}'],
|
|
233
239
|
languageOptions: {
|
|
234
240
|
ecmaVersion: 'latest',
|
|
235
241
|
sourceType: 'module'
|
|
236
242
|
},
|
|
237
|
-
rules:
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
rules: ESLINT_RECOMMENDED_JS_LIKE_RULES
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
files: ['**/*.cjs'],
|
|
247
|
+
languageOptions: {
|
|
248
|
+
ecmaVersion: 'latest',
|
|
249
|
+
sourceType: 'commonjs'
|
|
250
|
+
},
|
|
251
|
+
rules: ESLINT_RECOMMENDED_JS_LIKE_RULES
|
|
241
252
|
},
|
|
242
253
|
// Unicorn правила (лише JS-подібні файли — узгоджено з блоком рекомендованих правил ESLint)
|
|
243
254
|
...(Array.isArray(unicornPlugin.configs.recommended)
|
|
@@ -246,6 +257,8 @@ const all = [
|
|
|
246
257
|
{
|
|
247
258
|
files: UNICORN_FILES,
|
|
248
259
|
rules: {
|
|
260
|
+
// `continue` у циклах — ок; область збігається з UNICORN_FILES (js/mjs/cjs/vue).
|
|
261
|
+
'no-continue': 'off',
|
|
249
262
|
'unicorn/filename-case': 'off',
|
|
250
263
|
'unicorn/no-null': 'off',
|
|
251
264
|
'unicorn/prefer-string-slice': 'off',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitra/eslint-config",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.12",
|
|
4
4
|
"description": "An ESLint shareable config for projects using Vue and Node",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"graphql-eslint-anchor.js",
|
|
18
|
-
"index.
|
|
19
|
-
"
|
|
18
|
+
"index.js",
|
|
19
|
+
"types"
|
|
20
20
|
],
|
|
21
21
|
"type": "module",
|
|
22
|
-
"types": "./index.d.ts",
|
|
22
|
+
"types": "./types/index.d.ts",
|
|
23
23
|
"exports": "./index.js",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@e18e/eslint-plugin": "^0.3.0",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Шлях для graphql-config: для віртуальних блоків Vue — фізичний .vue, інакше той самий filePath.
|
|
3
|
+
* @param {string} filePath шлях файлу, який обробляє processor
|
|
4
|
+
* @returns {string} шлях для loadOnDiskGraphQLConfig та getProjectForFile
|
|
5
|
+
*/
|
|
6
|
+
export function graphQLConfigPathAnchor(filePath?: string): string
|
|
7
|
+
/**
|
|
8
|
+
* Парсер graphql-eslint: той самий anchor для filePath, щоб loadGraphQLConfig знаходив проєкт для віртуальних document.graphql з-під Vue.
|
|
9
|
+
* @param {string} code вміст GraphQL-документа
|
|
10
|
+
* @param {import('eslint').Linter.ParserOptions} options опції ESLint (filePath тощо)
|
|
11
|
+
* @returns {ReturnType<typeof baseParser.parseForESLint>} AST і parserServices для graphql-eslint
|
|
12
|
+
*/
|
|
13
|
+
export function graphqlParseForESLintWithAnchor(
|
|
14
|
+
code: string,
|
|
15
|
+
options?: import('eslint').Linter.ParserOptions
|
|
16
|
+
): ReturnType<typeof baseParser.parseForESLint>
|
|
17
|
+
export namespace graphqlCodefileProcessor {
|
|
18
|
+
namespace meta {
|
|
19
|
+
export let name: string
|
|
20
|
+
export { version }
|
|
21
|
+
}
|
|
22
|
+
let supportsAutofix: boolean
|
|
23
|
+
function preprocess(code: any, filePath: any): any[]
|
|
24
|
+
function postprocess(messages: any, filePath: any): any
|
|
25
|
+
}
|
|
26
|
+
export namespace graphqlParserWithConfigAnchor {
|
|
27
|
+
let meta_1: {
|
|
28
|
+
name: string
|
|
29
|
+
version: string | undefined
|
|
30
|
+
}
|
|
31
|
+
export { meta_1 as meta }
|
|
32
|
+
export { graphqlParseForESLintWithAnchor as parseForESLint }
|
|
33
|
+
}
|
|
34
|
+
declare const baseParser: {
|
|
35
|
+
parseForESLint: typeof import('@graphql-eslint/eslint-plugin').parseForESLint
|
|
36
|
+
meta: {
|
|
37
|
+
name: string
|
|
38
|
+
version: string | undefined
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
import { version } from '@graphql-eslint/eslint-plugin/meta'
|
|
42
|
+
export {}
|
|
File without changes
|