@advdominion/eslint-config 1.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.
Files changed (3) hide show
  1. package/README.md +26 -0
  2. package/index.js +134 -0
  3. package/package.json +29 -0
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # Конфигурация для ESLint
2
+
3
+ Включает в себя:
4
+
5
+ - [js/recommended](https://eslint.org/docs/latest/use/configure/configuration-files#using-predefined-configurations) из ESLint
6
+ - [eslint-plugin-simple-import-sort](https://github.com/lydell/eslint-plugin-simple-import-sort)
7
+ - [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
8
+ - [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue)
9
+
10
+ ## Использование
11
+
12
+ ### Требования
13
+
14
+ - [ESLint](https://eslint.org/)
15
+
16
+ ### Подключание
17
+
18
+ ```js
19
+ import { defineConfig } from 'eslint/config';
20
+ import config from '@advdominion/eslint-config';
21
+
22
+ export default defineConfig([
23
+ ...config,
24
+ // Дополнительная конфигурация проекта
25
+ ]);
26
+ ```
package/index.js ADDED
@@ -0,0 +1,134 @@
1
+ import js from '@eslint/js';
2
+ import eslintConfigPrettier from 'eslint-config-prettier';
3
+ import simpleImportSort from 'eslint-plugin-simple-import-sort';
4
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn';
5
+ import pluginVue from 'eslint-plugin-vue';
6
+ import globals from 'globals';
7
+
8
+ const config = [
9
+ {
10
+ languageOptions: {
11
+ ecmaVersion: 'latest',
12
+ sourceType: 'module',
13
+ globals: {
14
+ ...globals.browser,
15
+ ...globals.nodeBuiltin,
16
+ },
17
+ },
18
+ },
19
+ js.configs.recommended,
20
+ {
21
+ rules: {
22
+ ...{
23
+ 'array-callback-return': 'error',
24
+ 'no-await-in-loop': 'warn',
25
+ 'no-duplicate-imports': 'warn',
26
+ 'no-promise-executor-return': 'error',
27
+ 'no-self-compare': 'error',
28
+ 'no-template-curly-in-string': 'warn',
29
+ 'no-unassigned-vars': 'warn',
30
+ 'no-unmodified-loop-condition': 'error',
31
+ 'no-unreachable-loop': 'error',
32
+ 'no-use-before-define': 'error',
33
+ 'no-useless-assignment': 'warn',
34
+ },
35
+ ...{
36
+ 'dot-notation': 'warn',
37
+ 'eqeqeq': 'error',
38
+ 'no-implicit-coercion': 'warn',
39
+ 'no-negated-condition': 'warn',
40
+ 'no-useless-concat': 'warn',
41
+ 'object-shorthand': 'warn',
42
+ 'func-style': 'error',
43
+ 'no-console': ['warn', { allow: ['warn', 'error'] }],
44
+ 'no-param-reassign': 'error',
45
+ 'no-var': 'error',
46
+ 'one-var': ['warn', 'never'],
47
+ 'prefer-const': 'warn',
48
+ 'prefer-template': 'warn',
49
+ },
50
+ },
51
+ },
52
+ {
53
+ plugins: {
54
+ 'simple-import-sort': simpleImportSort,
55
+ },
56
+ rules: {
57
+ 'simple-import-sort/imports': 'warn',
58
+ },
59
+ },
60
+ {
61
+ plugins: {
62
+ unicorn: eslintPluginUnicorn,
63
+ },
64
+ rules: {
65
+ ...Object.fromEntries(
66
+ Object.entries(eslintPluginUnicorn.configs.recommended.rules).map(([rule, level]) => [
67
+ rule,
68
+ level === 'off' ? 'off' : 'warn',
69
+ ]),
70
+ ),
71
+ 'unicorn/better-regex': 'warn',
72
+ 'unicorn/filename-case': ['warn', { cases: { kebabCase: true, pascalCase: true } }],
73
+ 'unicorn/prefer-global-this': 'off',
74
+ 'unicorn/prefer-import-meta-properties': 'warn',
75
+ 'unicorn/prefer-top-level-await': 'off',
76
+ 'unicorn/prevent-abbreviations': 'off',
77
+ },
78
+ },
79
+ ...pluginVue.configs['flat/recommended'],
80
+ {
81
+ rules: {
82
+ ...{
83
+ 'vue/no-required-prop-with-default': 'warn',
84
+ 'vue/no-v-html': 'off',
85
+ 'vue/one-component-per-file': 'off',
86
+ },
87
+ ...{
88
+ 'vue/component-name-in-template-casing': 'warn',
89
+ 'vue/component-options-name-casing': 'warn',
90
+ 'vue/custom-event-name-casing': 'warn',
91
+ 'vue/match-component-file-name': ['warn', { extensions: ['vue'], shouldMatchCase: true }],
92
+ 'vue/match-component-import-name': 'warn',
93
+ 'vue/no-boolean-default': 'warn',
94
+ 'vue/no-potential-component-option-typo': 'warn',
95
+ 'vue/no-useless-mustaches': 'warn',
96
+ 'vue/no-useless-v-bind': 'warn',
97
+ 'vue/require-direct-export': 'warn',
98
+ 'vue/require-name-property': 'warn',
99
+ 'vue/v-for-delimiter-style': 'warn',
100
+ 'vue/v-on-handler-style': ['warn', 'inline'],
101
+ },
102
+ ...{
103
+ 'vue/dot-notation': 'warn',
104
+ 'vue/eqeqeq': 'error',
105
+ 'vue/no-console': ['warn', { allow: ['warn', 'error'] }],
106
+ 'vue/no-constant-condition': 'error',
107
+ 'vue/no-empty-pattern': 'error',
108
+ 'vue/no-implicit-coercion': 'warn',
109
+ 'vue/no-irregular-whitespace': 'error',
110
+ 'vue/no-loss-of-precision': 'error',
111
+ 'vue/no-negated-condition': 'warn',
112
+ 'vue/no-sparse-arrays': 'error',
113
+ 'vue/no-useless-concat': 'warn',
114
+ 'vue/object-shorthand': 'warn',
115
+ 'vue/prefer-template': 'warn',
116
+ },
117
+ },
118
+ },
119
+ {
120
+ files: ['build-scripts/*.js'],
121
+ rules: {
122
+ 'no-console': 'off',
123
+ },
124
+ },
125
+ {
126
+ files: ['src/scripts/components/*.vue'],
127
+ rules: {
128
+ 'no-useless-assignment': 'off',
129
+ },
130
+ },
131
+ eslintConfigPrettier,
132
+ ];
133
+
134
+ export default config;
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@advdominion/eslint-config",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://gitea.optiweb.ru/public/configs.git"
9
+ },
10
+ "license": "MIT",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "dependencies": {
15
+ "@eslint/js": "^9.39.2",
16
+ "eslint-config-prettier": "^10.1.8",
17
+ "eslint-plugin-simple-import-sort": "^12.1.1",
18
+ "eslint-plugin-unicorn": "^62.0.0",
19
+ "eslint-plugin-vue": "^10.6.2",
20
+ "globals": "^16.5.0",
21
+ "vue-eslint-parser": "^10.2.0"
22
+ },
23
+ "peerDependencies": {
24
+ "eslint": "^9.39.0"
25
+ },
26
+ "devDependencies": {
27
+ "eslint": "^9.39.0"
28
+ }
29
+ }