@alexlit/config-eslint 103.0.1 → 105.0.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/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { javascript } from './plugins/javascript.js';
2
2
  export { jsdoc } from './plugins/jsdoc.js';
3
+ export { json } from './plugins/json.js';
3
4
  export { perfectionist } from './plugins/perfectionist.js';
4
5
  export { prettier, prettierConfig } from './plugins/prettier.js';
5
6
  export { regexp } from './plugins/regexp.js';
package/package.json CHANGED
@@ -1,40 +1,42 @@
1
1
  {
2
2
  "name": "@alexlit/config-eslint",
3
- "version": "103.0.1",
3
+ "version": "105.0.0",
4
4
  "private": false,
5
- "description": "Eslint config",
5
+ "description": "Sharable ESLint configuration",
6
6
  "keywords": [
7
7
  "eslint",
8
- "config"
8
+ "eslint-config",
9
+ "lint",
10
+ "code-quality",
11
+ "javascript",
12
+ "typescript"
9
13
  ],
10
- "homepage": "https://github.com/alex-lit/lint-kit#readme",
14
+ "homepage": "https://github.com/alex-lit/lint-kit/tree/main/packages/config-eslint#readme",
11
15
  "bugs": {
12
16
  "url": "https://github.com/alex-lit/lint-kit/issues"
13
17
  },
14
18
  "repository": {
15
19
  "type": "git",
16
- "url": "https://github.com/alex-lit/lint-kit.git",
20
+ "url": "git+https://github.com/alex-lit/lint-kit.git",
17
21
  "directory": "packages/config-eslint"
18
22
  },
19
23
  "license": "MIT",
20
- "author": "Alexey Litovchenko",
21
- "maintainers": [
22
- "Alexey Litovchenko <alex.lit@outlook.com> (https://alexlit.gitlab.io)"
23
- ],
24
+ "author": "Alexey Litovchenko <alex.lit@outlook.com> (https://github.com/alex-lit)",
24
25
  "type": "module",
25
- "main": "index.js",
26
+ "main": "./index.js",
26
27
  "files": [
27
- "README.md",
28
28
  "index.js",
29
- "plugins",
30
- "presets"
29
+ "plugins/",
30
+ "presets/",
31
+ "README.md"
31
32
  ],
32
33
  "dependencies": {
33
34
  "@eslint/js": "^9.20.0",
35
+ "@eslint/json": "^0.10.0",
34
36
  "@intlify/eslint-plugin-vue-i18n": "^3.2.0",
35
- "@stylistic/eslint-plugin": "^4.0.0",
37
+ "@stylistic/eslint-plugin": "^4.0.1",
36
38
  "@tanstack/eslint-plugin-query": "^5.66.1",
37
- "@unocss/eslint-config": "^65.5.0",
39
+ "@unocss/eslint-config": "^66.0.0",
38
40
  "eslint": "9.20.1",
39
41
  "eslint-config-prettier": "^10.0.1",
40
42
  "eslint-plugin-jsdoc": "^50.6.3",
@@ -52,14 +54,19 @@
52
54
  "typescript-eslint": "^8.24.1"
53
55
  },
54
56
  "engines": {
55
- "node": ">=18.18"
57
+ "node": ">=18.18",
58
+ "pnpm": ">=9"
59
+ },
60
+ "publishConfig": {
61
+ "access": "public",
62
+ "registry": "https://registry.npmjs.org/"
56
63
  },
57
64
  "scripts": {
58
65
  "inspect": "npx @eslint/config-inspector@latest",
59
66
  "lint": "cd ../../ && ./scripts/lint.eslint.sh",
60
- "ou": "../../scripts/ou.sh --local",
61
- "release": "../../scripts/release.sh",
62
- "semver": "../../scripts/semver.sh",
63
- "up": "../../scripts/up.sh --local"
67
+ "ou": "sh ../../scripts/ou.sh --local",
68
+ "release": "sh ../../scripts/release.sh",
69
+ "semver": "sh ../../scripts/semver.sh",
70
+ "up": "sh ../../scripts/up.sh --local"
64
71
  }
65
72
  }
@@ -1,12 +1,17 @@
1
1
  import plugin from '@eslint/js';
2
2
 
3
+ import { FILES } from '../presets/_base.js';
4
+
3
5
  /** @see [eslint](https://eslint.org) */
4
6
  export const javascript = [
5
- plugin.configs.recommended,
6
-
7
7
  {
8
+ files: FILES,
9
+ ...plugin.configs.recommended,
10
+ },
11
+ {
12
+ files: FILES,
8
13
  rules: {
9
- curly: 'error',
14
+ 'curly': 'error',
10
15
  'dot-notation': ['error'],
11
16
  'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
12
17
  'grouped-accessor-pairs': ['error', 'getBeforeSet'],
package/plugins/jsdoc.js CHANGED
@@ -1,9 +1,15 @@
1
1
  import plugin from 'eslint-plugin-jsdoc';
2
2
 
3
+ import { FILES } from '../presets/_base.js';
4
+
3
5
  /** @see [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) */
4
6
  export const jsdoc = [
5
- plugin.configs['flat/recommended'],
6
7
  {
8
+ files: FILES,
9
+ ...plugin.configs['flat/recommended'],
10
+ },
11
+ {
12
+ files: FILES,
7
13
  rules: {
8
14
  'jsdoc/lines-before-block': 'off',
9
15
  'jsdoc/no-undefined-types': 'off',
@@ -0,0 +1,34 @@
1
+ import plugin from '@eslint/json';
2
+
3
+ /** @see [eslint/json](https://github.com/eslint/json) */
4
+ export const json = [
5
+ // json
6
+ {
7
+ files: ['**/*.json'],
8
+ ignores: ['package-lock.json'],
9
+ language: 'json/json',
10
+ ...plugin.configs.recommended,
11
+ },
12
+ {
13
+ files: ['**/*.json'],
14
+ ignores: ['**/package.json', '**/package-lock.json'],
15
+ rules: {
16
+ 'json/sort-keys': 'warn',
17
+ 'json/top-level-interop': 'error',
18
+ },
19
+ },
20
+
21
+ // jsonc
22
+ {
23
+ files: ['**/*.jsonc'],
24
+ language: 'json/jsonc',
25
+ ...plugin.configs.recommended,
26
+ },
27
+
28
+ // json5
29
+ {
30
+ files: ['**/*.json5'],
31
+ language: 'json/json5',
32
+ ...plugin.configs.recommended,
33
+ },
34
+ ];
@@ -1,9 +1,15 @@
1
1
  import plugin from 'eslint-plugin-perfectionist';
2
2
 
3
+ import { FILES } from '../presets/_base.js';
4
+
3
5
  /** @see [eslint-plugin-perfectionist](https://perfectionist.dev) */
4
6
  export const perfectionist = [
5
- plugin.configs['recommended-natural'],
6
7
  {
8
+ files: FILES,
9
+ ...plugin.configs['recommended-natural'],
10
+ },
11
+ {
12
+ files: FILES,
7
13
  rules: {
8
14
  'perfectionist/sort-imports': [
9
15
  'warn',
@@ -1,6 +1,8 @@
1
1
  import config from 'eslint-config-prettier';
2
2
  import plugin from 'eslint-plugin-prettier/recommended';
3
3
 
4
+ import { FILES } from '../presets/_base.js';
5
+
4
6
  const fixes = {
5
7
  // fix for prettier/vue
6
8
  'vue/html-self-closing': [
@@ -19,7 +21,7 @@ const fixes = {
19
21
 
20
22
  /** @see [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) */
21
23
  export const prettier = [
22
- plugin,
24
+ { files: FILES, ...plugin },
23
25
  {
24
26
  files: ['**/*.vue'],
25
27
  rules: { ...fixes },
@@ -28,7 +30,7 @@ export const prettier = [
28
30
 
29
31
  /** @see [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) */
30
32
  export const prettierConfig = [
31
- config,
33
+ { files: FILES, ...config },
32
34
  {
33
35
  files: ['**/*.vue'],
34
36
  rules: { ...fixes },
package/plugins/regexp.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import plugin from 'eslint-plugin-regexp';
2
2
 
3
+ import { FILES } from '../presets/_base.js';
4
+
3
5
  /** @see [eslint-plugin-regexp](https://github.com/ota-meshi/eslint-plugin-regexp) */
4
- export const regexp = [plugin.configs['flat/recommended']];
6
+ export const regexp = [{ files: FILES, ...plugin.configs['flat/recommended'] }];
package/plugins/sonar.js CHANGED
@@ -1,9 +1,15 @@
1
1
  import plugin from 'eslint-plugin-sonarjs';
2
2
 
3
+ import { FILES } from '../presets/_base.js';
4
+
3
5
  /** @see [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs) */
4
6
  export const sonar = [
5
- plugin.configs.recommended,
6
7
  {
8
+ files: FILES,
9
+ ...plugin.configs.recommended,
10
+ },
11
+ {
12
+ files: FILES,
7
13
  plugins: {
8
14
  sonar: plugin,
9
15
  },
@@ -1,8 +1,11 @@
1
1
  import plugin from '@stylistic/eslint-plugin';
2
2
 
3
+ import { FILES } from '../presets/_base.js';
4
+
3
5
  /** @see [@stylistic/eslint-plugin](https://eslint.style/) */
4
6
  export const stylistic = [
5
7
  {
8
+ files: FILES,
6
9
  plugins: {
7
10
  '@stylistic': plugin,
8
11
  },
@@ -1,10 +1,12 @@
1
1
  // import tailwind from 'eslint-plugin-tailwindcss';
2
+ import { FILES } from '../presets/_base.js';
2
3
 
3
4
  /** @see [eslint-plugin-tailwindcss](https://github.com/francoismassart/eslint-plugin-tailwindcss) */
4
5
  export const tailwindcss = [
5
6
  // TODO: включить после обновления плагина
6
7
  // ...tailwind.configs['flat/recommended'],
7
8
  {
9
+ files: FILES,
8
10
  rules: {
9
11
  // 'tailwindcss/no-custom-classname': 'off',
10
12
  'vue/static-class-names-order': 'off',
@@ -1,11 +1,14 @@
1
1
  import plugin from 'typescript-eslint';
2
2
 
3
+ import { FILES } from '../presets/_base.js';
4
+
3
5
  /** @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) */
4
6
  export const typescript = [
5
7
  ...plugin.configs.strict,
6
8
  ...plugin.configs.stylistic,
7
9
 
8
10
  {
11
+ files: FILES,
9
12
  rules: {
10
13
  '@typescript-eslint/no-explicit-any': 'warn',
11
14
  },
@@ -1,9 +1,15 @@
1
1
  import plugin from 'eslint-plugin-unicorn';
2
2
 
3
+ import { FILES } from '../presets/_base.js';
4
+
3
5
  /** @see [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) */
4
6
  export const unicorn = [
5
- plugin.configs['flat/all'],
6
7
  {
8
+ files: FILES,
9
+ ...plugin.configs['flat/all'],
10
+ },
11
+ {
12
+ files: FILES,
7
13
  rules: {
8
14
  'unicorn/better-regex': 'off',
9
15
  'unicorn/consistent-destructuring': 'warn',
package/plugins/unocss.js CHANGED
@@ -1,9 +1,15 @@
1
1
  import plugin from '@unocss/eslint-config/flat';
2
2
 
3
+ import { FILES } from '../presets/_base.js';
4
+
3
5
  /** @see [@unocss/eslint-config](https://unocss.dev/integrations/eslint) */
4
6
  export const unocss = [
5
- plugin,
6
7
  {
8
+ files: FILES,
9
+ ...plugin,
10
+ },
11
+ {
12
+ files: FILES,
7
13
  rules: {
8
14
  'unocss/order-attributify': 'off',
9
15
  },
@@ -3,6 +3,7 @@ import plugin from 'eslint-plugin-vuejs-accessibility';
3
3
  /** @see [eslint-plugin-vuejs-accessibility](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/) */
4
4
  export const vueAccessibility = [
5
5
  ...plugin.configs['flat/recommended'],
6
+
6
7
  {
7
8
  files: ['**/*.vue'],
8
9
  rules: {
@@ -2,7 +2,11 @@ import plugin from '@intlify/eslint-plugin-vue-i18n';
2
2
 
3
3
  /** @see [eslint-plugin-vue-i18n](https://eslint-plugin-vue-i18n.intlify.dev/) */
4
4
  export const vueI18n = [
5
- ...plugin.configs['flat/recommended'],
5
+ ...plugin.configs['flat/recommended'].map((config) => ({
6
+ ...config,
7
+ files: ['**/*.vue'],
8
+ })),
9
+
6
10
  {
7
11
  files: ['**/*.vue'],
8
12
  rules: {
@@ -24,6 +28,8 @@ export const vueI18n = [
24
28
  '@intlify/vue-i18n/no-unused-keys': 'warn',
25
29
  '@intlify/vue-i18n/prefer-sfc-lang-attr': 'error',
26
30
  },
31
+ },
32
+ {
27
33
  settings: {
28
34
  'vue-i18n': {
29
35
  localeDir: './**/locales/*.{json,json5,yaml,yml}',
package/plugins/vue.js CHANGED
@@ -3,7 +3,11 @@ import typescript from 'typescript-eslint';
3
3
 
4
4
  /** @see [eslint-plugin-vue](https://eslint.vuejs.org/rules/) */
5
5
  export const vue = [
6
- ...plugin.configs['flat/recommended'],
6
+ ...plugin.configs['flat/recommended'].map((config) => ({
7
+ ...config,
8
+ files: ['**/*.vue'],
9
+ })),
10
+
7
11
  {
8
12
  files: ['**/*.vue'],
9
13
  languageOptions: { parserOptions: { parser: typescript.parser } },
package/presets/_base.js CHANGED
@@ -1,11 +1,15 @@
1
1
  import globals from 'globals';
2
2
 
3
+ export const FILES = ['**/*.{js,mjs,cjs,typescript,vue}'];
4
+
3
5
  /** Base config */
4
6
  export const _base = [
5
7
  {
6
- files: ['**/*.{js,mjs,cjs,typescript,vue}'],
8
+ files: FILES,
9
+ languageOptions: {
10
+ globals: globals.browser,
11
+ },
7
12
  },
8
-
9
13
  {
10
14
  ignores: [
11
15
  '**/.temp',
@@ -19,6 +23,4 @@ export const _base = [
19
23
  'sw.js',
20
24
  ],
21
25
  },
22
-
23
- { languageOptions: { globals: globals.browser } },
24
26
  ];
@@ -1,5 +1,6 @@
1
1
  import { javascript } from '../plugins/javascript.js';
2
2
  import { jsdoc } from '../plugins/jsdoc.js';
3
+ import { json } from '../plugins/json.js';
3
4
  import { perfectionist } from '../plugins/perfectionist.js';
4
5
  import { prettierConfig } from '../plugins/prettier.js';
5
6
  import { regexp } from '../plugins/regexp.js';
@@ -19,6 +20,7 @@ export const defaultPreset = [
19
20
 
20
21
  ...javascript,
21
22
  ...jsdoc,
23
+ ...json,
22
24
  ...perfectionist,
23
25
  ...regexp,
24
26
  ...sonar,