@nitra/eslint-config 3.0.10 → 3.1.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.
Files changed (3) hide show
  1. package/README.md +63 -35
  2. package/index.js +8 -4
  3. package/package.json +23 -19
package/README.md CHANGED
@@ -1,51 +1,79 @@
1
- # eslint-config
1
+ # @nitra/eslint-config
2
2
 
3
- ## Installation
3
+ Спільна конфігурація ESLint 10 (flat config) для проєктів на Vue та Node.js.
4
+
5
+ ## Вимоги
6
+
7
+ - **ESLint 10+** (тільки flat config, eslintrc більше не підтримується)
8
+ - **Node.js 20.19.0+**
9
+
10
+ ## Встановлення
4
11
 
5
12
  ```sh
6
13
  bun add @nitra/eslint-config -D
7
14
  ```
8
15
 
9
- _This is only a shareable configuration. It does not install Prettier, Standard,
10
- ESLint, or any other part of the tool chain._
16
+ _Це лише спільна конфігурація. Prettier, ESLint та плагіни потрібно встановлювати окремо або вони підтягнуться як залежності._
11
17
 
12
- ## Usage
18
+ ## Використання
13
19
 
14
- Reference it in `package.json` using the `eslintConfig` property.
20
+ У корені проєкту створіть **`eslint.config.js`** (або `eslint.config.mjs`):
15
21
 
16
- Root:
22
+ ```js
23
+ import { getConfig } from '@nitra/eslint-config'
17
24
 
18
- ```json
19
- "eslintConfig": {
20
- "extends": [
21
- "@nitra"
22
- ],
23
- "root": true
24
- }
25
+ export default getConfig({
26
+ node: ['src/server', 'scripts'], // шляхи до Node.js коду
27
+ vue: ['src/frontend'], // шляхи до Vue 3
28
+ vue2: [] // шляхи до Vue 2 (якщо є)
29
+ })
25
30
  ```
26
31
 
27
- Node:
28
-
29
- ```json
30
- "engines": {
31
- "node": ">=18.0.0"
32
- },
33
- "eslintConfig": {
34
- "extends": [
35
- "@nitra/eslint-config/node"
36
- ]
37
- }
38
- ```
32
+ - **Тільки Node.js** — передайте лише `node`:
33
+
34
+ ```js
35
+ export default getConfig({ node: ['.'] })
36
+ ```
37
+
38
+ - **Тільки Vue** — передайте лише `vue` або `vue2`:
39
39
 
40
- Vue:
40
+ ```js
41
+ export default getConfig({ vue: ['src'] })
42
+ ```
41
43
 
42
- ```json
43
- "eslintConfig": {
44
- "extends": [
45
- "@nitra/eslint-config/vue"
46
- ],
47
- "globals": {
48
- "localStorage": "readonly"
44
+ - **Monorepo** — укажіть відповідні директорії:
45
+ ```js
46
+ export default getConfig({
47
+ node: ['apps/api', 'packages/cli'],
48
+ vue: ['apps/web'],
49
+ vue2: ['apps/legacy']
50
+ })
51
+ ```
52
+
53
+ ### Додаткові глобали (опційно)
54
+
55
+ Якщо потрібні додаткові глобальні змінні (наприклад, для Vue), їх можна додати окремим блоком у вашому `eslint.config.js` після виклику `getConfig()`:
56
+
57
+ ```js
58
+ import { getConfig } from '@nitra/eslint-config'
59
+
60
+ export default [
61
+ ...getConfig({ vue: ['src'] }),
62
+ {
63
+ files: ['src/**/*.{js,vue}'],
64
+ languageOptions: {
65
+ globals: {
66
+ localStorage: 'readonly'
67
+ }
68
+ }
49
69
  }
50
- }
70
+ ]
51
71
  ```
72
+
73
+ ## Що входить у конфіг
74
+
75
+ - Базові правила JS (recommended), Prettier, JSDoc, Import, Unicorn
76
+ - YAML і Markdown
77
+ - Для **Node**: eslint-plugin-n, security
78
+ - Для **Vue**: eslint-plugin-vue з правилами атрибутів та порядку
79
+ - Oxlint (recommended)
package/index.js CHANGED
@@ -14,8 +14,13 @@ import globals from 'globals'
14
14
  // import configStandard from 'eslint-config-standard'
15
15
 
16
16
  // Перевизначаємо версію EcmaScript на останню
17
- const importPluginEcmaLatest = importPlugin.recommended
18
- importPluginEcmaLatest.languageOptions.ecmaVersion = 'latest'
17
+ const importPluginEcmaLatest = {
18
+ ...importPlugin.recommended,
19
+ languageOptions: {
20
+ ...(importPlugin.recommended?.languageOptions ?? {}),
21
+ ecmaVersion: 'latest'
22
+ }
23
+ }
19
24
 
20
25
  const all = [
21
26
  {
@@ -31,7 +36,6 @@ const all = [
31
36
  importPluginEcmaLatest,
32
37
  {
33
38
  rules: {
34
- 'no-continue': 'off',
35
39
  'import/no-unresolved': 'off', // не працює з monorepo та #alias
36
40
  'import/newline-after-import': ['error', { count: 1 }],
37
41
  // 'import/order': ['error', { warnOnUnassignedImports: true }],
@@ -53,7 +57,7 @@ const all = [
53
57
  }
54
58
  },
55
59
  // Unicorn правила
56
- unicornPlugin.configs['flat/recommended'],
60
+ unicornPlugin.configs.recommended,
57
61
  {
58
62
  rules: {
59
63
  'unicorn/filename-case': 'off',
package/package.json CHANGED
@@ -1,36 +1,40 @@
1
1
  {
2
2
  "name": "@nitra/eslint-config",
3
- "version": "3.0.10",
3
+ "version": "3.1.0",
4
4
  "description": "A Eslint shareable config for projects using 'Vue' and 'Node'",
5
- "type": "module",
6
- "exports": "./index.js",
5
+ "keywords": [
6
+ "eslint",
7
+ "eslintconfig",
8
+ "flat-config",
9
+ "nitra"
10
+ ],
11
+ "license": "AGPL-3.0-or-later",
7
12
  "repository": {
8
13
  "type": "git",
9
14
  "url": "git@github.com:nitra/eslint-config.git"
10
15
  },
11
- "keywords": [
12
- "nitra",
13
- "eslint",
14
- "eslintconfig"
16
+ "files": [
17
+ "index.js"
15
18
  ],
19
+ "type": "module",
20
+ "exports": "./index.js",
16
21
  "dependencies": {
17
- "@eslint/js": "^9.39.1",
18
- "eslint": "^9.39.1",
22
+ "@eslint/js": "^10.0.1",
23
+ "eslint": "^10.0.0",
19
24
  "eslint-config-prettier": "^10.1.8",
20
25
  "eslint-plugin-import": "^2.32.0",
21
- "eslint-plugin-jsdoc": "^61.2.1",
26
+ "eslint-plugin-jsdoc": "^62.5.3",
22
27
  "eslint-plugin-markdown": "^5.1.0",
23
- "eslint-plugin-n": "^17.23.1",
24
- "eslint-plugin-oxlint": "^1.29.0",
28
+ "eslint-plugin-n": "^17.23.2",
29
+ "eslint-plugin-oxlint": "^1.43.0",
25
30
  "eslint-plugin-security": "^3.0.1",
26
31
  "eslint-plugin-unicorn": "^62.0.0",
27
- "eslint-plugin-vue": "^10.5.1",
28
- "eslint-plugin-yml": "^1.19.0",
29
- "globals": "^16.5.0",
32
+ "eslint-plugin-vue": "^10.7.0",
33
+ "eslint-plugin-yml": "^3.0.0",
34
+ "globals": "^17.3.0",
30
35
  "vue-eslint-parser": "^10.2.0"
31
36
  },
32
- "files": [
33
- "index.js"
34
- ],
35
- "license": "AGPL-3.0-or-later"
37
+ "engines": {
38
+ "node": ">=20.19.0"
39
+ }
36
40
  }