@ivanmaxlogiudice/eslint-config 1.0.0-beta.9 → 1.0.6

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/src/markdown.js DELETED
@@ -1,43 +0,0 @@
1
- import markdownPlugin from 'eslint-plugin-markdown'
2
- import tsPlugin from '@typescript-eslint/eslint-plugin'
3
-
4
- import { GLOB_MARKDOWN, GLOB_SRC, GLOB_VUE } from './shared.js'
5
-
6
- /** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
7
- export const markdown = [
8
- {
9
- files: [GLOB_MARKDOWN],
10
- plugins: {
11
- markdown: markdownPlugin,
12
- },
13
- processor: 'markdown/markdown',
14
- },
15
- {
16
- files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
17
- languageOptions: {
18
- parserOptions: {
19
- ecmaFeatures: {
20
- impliedStrict: true,
21
- },
22
- },
23
- },
24
- plugins: {
25
- '@typescript-eslint': tsPlugin,
26
- },
27
- rules: {
28
- ...markdownPlugin.configs.recommended.overrides[1].rules,
29
-
30
- '@typescript-eslint/no-redeclare': 'off',
31
- '@typescript-eslint/no-unused-vars': 'off',
32
- '@typescript-eslint/no-use-before-define': 'off',
33
- '@typescript-eslint/no-var-requires': 'off',
34
-
35
- 'no-alert': 'off',
36
- 'no-console': 'off',
37
- 'no-restricted-imports': 'off',
38
- 'no-undef': 'off',
39
- 'no-unused-expressions': 'off',
40
- 'no-unused-vars': 'off',
41
- },
42
- },
43
- ]
package/src/presets.js DELETED
@@ -1,69 +0,0 @@
1
- // @ts-check
2
-
3
- import { eslintComments } from './eslint-comments.js'
4
- import { imports, js, jsx, unicorn } from './js.js'
5
- import { jsonc, pkgOrder } from './jsonc.js'
6
- import { typescript } from './typescript.js'
7
- import { unocss } from './unocss.js'
8
- import { markdown } from './markdown.js'
9
- import { yml } from './yml.js'
10
- import { vue } from './vue.js'
11
-
12
- import { GLOB_EXCLUDE } from './shared.js'
13
-
14
- /**
15
- * @typedef { import('eslint-define-config').FlatESLintConfigItem } FlatESLintConfigItem
16
- */
17
-
18
- /** @type {FlatESLintConfigItem[]} */
19
- export const basic = [
20
- // @ts-ignore
21
- { ignores: GLOB_EXCLUDE },
22
-
23
- ...js,
24
- ...jsx,
25
- ...typescript,
26
- ...imports,
27
- ...unicorn,
28
- ...jsonc,
29
- ...pkgOrder,
30
- ...yml,
31
- ...eslintComments,
32
- ]
33
-
34
- /** @type {FlatESLintConfigItem[]} */
35
- export const all = [
36
- ...basic,
37
- ...vue,
38
- ...unocss,
39
- ]
40
-
41
- /** @type {(config?: FlatESLintConfigItem | FlatESLintConfigItem[], enables?: Partial<{
42
- * vue: boolean
43
- * markdown: boolean
44
- * unocss: boolean
45
- * }>) => FlatESLintConfigItem[]} */
46
- export function config(
47
- config = [],
48
- {
49
- vue: enableVue = true,
50
- markdown: enableMarkdown = true,
51
- unocss: enableUnocss = false,
52
- } = {},
53
- ) {
54
- const configs = [...basic]
55
-
56
- if (enableVue !== false)
57
- configs.push(...vue)
58
-
59
- if (enableMarkdown !== false)
60
- configs.push(...markdown)
61
-
62
- if (enableUnocss !== false)
63
- configs.push(...unocss)
64
-
65
- if (Object.keys(config).length > 0)
66
- configs.push(...(Array.isArray(config) ? config : [config]))
67
-
68
- return configs
69
- }
package/src/shared.js DELETED
@@ -1,67 +0,0 @@
1
- // @ts-check
2
-
3
- export const GLOB_SRC_EXT = '?([cm])[jt]s?(x)'
4
- export const GLOB_SRC = '**/*.?([cm])[jt]s?(x)'
5
-
6
- export const GLOB_JS = '**/*.?([cm])js'
7
- export const GLOB_JSX = '**/*.?([cm])jsx'
8
-
9
- export const GLOB_TS = '**/*.?([cm])ts'
10
- export const GLOB_TSX = '**/*.?([cm])tsx'
11
-
12
- export const GLOB_STYLE = '**/*.{c,le,sc}ss'
13
- export const GLOB_CSS = '**/*.css'
14
- export const GLOB_LESS = '**/*.less'
15
- export const GLOB_SCSS = '**/*.scss'
16
-
17
- export const GLOB_JSON = '**/*.json'
18
- export const GLOB_JSON5 = '**/*.json5'
19
- export const GLOB_JSONC = '**/*.jsonc'
20
-
21
- export const GLOB_MARKDOWN = '**/*.md'
22
- export const GLOB_VUE = '**/*.vue'
23
- export const GLOB_YAML = '**/*.y?(a)ml'
24
- export const GLOB_HTML = '**/*.htm?(l)'
25
-
26
- export const GLOB_ALL_SRC = /** @type {const} */ ([
27
- GLOB_SRC,
28
- GLOB_STYLE,
29
- GLOB_JSON,
30
- GLOB_JSON5,
31
- GLOB_MARKDOWN,
32
- GLOB_VUE,
33
- GLOB_YAML,
34
- GLOB_HTML,
35
- ])
36
-
37
- export const GLOB_NODE_MODULES = /** @type {const} */ ('**/node_modules')
38
- export const GLOB_DIST = /** @type {const} */ ('**/dist')
39
- export const GLOB_LOCKFILE = /** @type {const} */ ([
40
- '**/package-lock.json',
41
- '**/yarn.lock',
42
- '**/pnpm-lock.yaml',
43
- ])
44
- export const GLOB_EXCLUDE = /** @type {const} */ ([
45
- GLOB_NODE_MODULES,
46
- GLOB_DIST,
47
- ...GLOB_LOCKFILE,
48
-
49
- '**/output',
50
- '**/coverage',
51
- '**/temp',
52
- '**/fixtures',
53
- '**/.vitepress/cache',
54
- '**/.nuxt',
55
- '**/.vercel',
56
- '**/.changeset',
57
- '**/.idea',
58
- '**/.output',
59
- '**/.vite-inspect',
60
-
61
- '**/CHANGELOG*.md',
62
- '**/*.min.*',
63
- '**/LICENSE*',
64
- '**/__snapshots__',
65
- '**/auto-import?(s).d.ts',
66
- '**/components.d.ts',
67
- ])
package/src/typescript.js DELETED
@@ -1,155 +0,0 @@
1
- import tsParser from '@typescript-eslint/parser'
2
- import tsPlugin from '@typescript-eslint/eslint-plugin'
3
- import { GLOB_TS, GLOB_TSX } from './shared.js'
4
-
5
- export { tsParser, tsPlugin }
6
-
7
- /** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
8
- export const typescript = [
9
- {
10
- files: [GLOB_TS, GLOB_TSX],
11
- languageOptions: {
12
- parser: tsParser,
13
- parserOptions: {
14
- sourceType: 'module',
15
- },
16
- },
17
- plugins: {
18
- '@typescript-eslint': tsPlugin,
19
- },
20
- rules: {
21
- ...tsPlugin.configs['eslint-recommended'].overrides[0].rules,
22
- ...tsPlugin.configs.strict.rules,
23
-
24
- '@typescript-eslint/ban-ts-comment': ['error', {
25
- 'ts-ignore': 'allow-with-description',
26
- }],
27
- '@typescript-eslint/consistent-type-imports': ['error', {
28
- disallowTypeAnnotations: false,
29
- fixStyle: 'inline-type-imports',
30
- }],
31
- '@typescript-eslint/prefer-as-const': 'warn',
32
- '@typescript-eslint/member-delimiter-style': ['error', {
33
- multiline: { delimiter: 'none' },
34
- }],
35
- '@typescript-eslint/type-annotation-spacing': 'error',
36
- '@typescript-eslint/no-require-imports': 'error',
37
- '@typescript-eslint/no-redeclare': 'error',
38
- '@typescript-eslint/no-dupe-class-members': 'error',
39
-
40
- // Override JS
41
- 'indent': 'off',
42
- '@typescript-eslint/indent': ['error', 4, {
43
- SwitchCase: 1,
44
- outerIIFEBody: 1,
45
- VariableDeclarator: 1,
46
- }],
47
-
48
- 'no-invalid-this': 'off',
49
- '@typescript-eslint/no-invalid-this': 'error',
50
-
51
- 'no-use-before-define': 'off',
52
- '@typescript-eslint/no-use-before-define': ['error', {
53
- classes: false,
54
- functions: false,
55
- variables: true,
56
- }],
57
-
58
- 'brace-style': 'off',
59
- '@typescript-eslint/brace-style': ['error', 'stroustrup', {
60
- allowSingleLine: true,
61
- }],
62
-
63
- 'comma-dangle': 'off',
64
- '@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
65
-
66
- 'object-curly-spacing': 'off',
67
- '@typescript-eslint/object-curly-spacing': ['error', 'always'],
68
-
69
- 'semi': 'off',
70
- '@typescript-eslint/semi': ['error', 'never'],
71
-
72
- 'quotes': 'off',
73
- '@typescript-eslint/quotes': ['error', 'single', {
74
- avoidEscape: true,
75
- }],
76
-
77
- 'space-before-blocks': 'off',
78
- '@typescript-eslint/space-before-blocks': ['error', 'always'],
79
-
80
- 'space-before-function-paren': 'off',
81
- '@typescript-eslint/space-before-function-paren': ['error', {
82
- anonymous: 'always',
83
- asyncArrow: 'always',
84
- named: 'never',
85
- }],
86
-
87
- 'space-infix-ops': 'off',
88
- '@typescript-eslint/space-infix-ops': 'error',
89
-
90
- 'keyword-spacing': 'off',
91
- '@typescript-eslint/keyword-spacing': ['error', {
92
- before: true,
93
- after: true,
94
- }],
95
-
96
- 'comma-spacing': 'off',
97
- '@typescript-eslint/comma-spacing': ['error', {
98
- before: false,
99
- after: true,
100
- }],
101
-
102
- 'no-extra-parens': 'off',
103
- '@typescript-eslint/no-extra-parens': ['error', 'functions'],
104
-
105
- 'no-loss-of-precision': 'off',
106
- '@typescript-eslint/no-loss-of-precision': 'error',
107
-
108
- 'lines-between-class-members': 'off',
109
- '@typescript-eslint/lines-between-class-members': ['error', 'always', {
110
- exceptAfterSingleLine: true,
111
- }],
112
-
113
- // antfu
114
- 'antfu/generic-spacing': 'error',
115
- 'antfu/no-cjs-exports': 'error',
116
- 'antfu/no-ts-export-equal': 'error',
117
- 'antfu/no-const-enum': 'error',
118
- 'antfu/named-tuple-spacing': 'error',
119
-
120
- // off
121
- 'import/named': 'off',
122
-
123
- '@typescript-eslint/no-unused-vars': 'off', // handled by unused-imports/no-unused-imports
124
- '@typescript-eslint/no-explicit-any': 'off',
125
- '@typescript-eslint/no-non-null-assertion': 'off',
126
- '@typescript-eslint/explicit-module-boundary-types': 'off',
127
- '@typescript-eslint/consistent-indexed-object-style': 'off',
128
- '@typescript-eslint/naming-convention': 'off',
129
- '@typescript-eslint/explicit-function-return-type': 'off',
130
- '@typescript-eslint/explicit-member-accessibility': 'off',
131
- '@typescript-eslint/ban-ts-ignore': 'off',
132
- '@typescript-eslint/no-empty-function': 'off',
133
- '@typescript-eslint/triple-slash-reference': 'off',
134
- },
135
- },
136
- {
137
- files: ['**/*.d.ts'],
138
- rules: {
139
- 'import/no-duplicates': 'off',
140
- },
141
- },
142
- {
143
- files: ['**/*.{test,spec}.ts?(x)'],
144
- rules: {
145
- 'no-unused-expressions': 'off',
146
- },
147
- },
148
- {
149
- files: ['**/*.js', '**/*.cjs'],
150
- rules: {
151
- '@typescript-eslint/no-var-requires': 'off',
152
- '@typescript-eslint/no-require-imports': 'off',
153
- },
154
- },
155
- ]
package/src/unocss.js DELETED
@@ -1,13 +0,0 @@
1
- import unocssPlugin from '@unocss/eslint-plugin'
2
-
3
- /** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
4
- export const unocss = [
5
- {
6
- plugins: {
7
- '@unocss': unocssPlugin,
8
- },
9
- rules: {
10
- ...unocssPlugin.configs.recommended.rules,
11
- },
12
- },
13
- ]
package/src/vue.js DELETED
@@ -1,198 +0,0 @@
1
- import { getPackageInfoSync } from 'local-pkg'
2
- import vueParser from 'vue-eslint-parser'
3
- import vuePlugin from 'eslint-plugin-vue'
4
- import tsPlugin from '@typescript-eslint/eslint-plugin'
5
-
6
- import { typescript } from './typescript.js'
7
- import { GLOB_VUE } from './shared.js'
8
-
9
- export { vueParser, vuePlugin }
10
-
11
- export function getVueVersion() {
12
- const pkg = getPackageInfoSync('vue', { paths: [process.cwd()] })
13
-
14
- if (pkg && typeof pkg.version === 'string' && !Number.isNaN(+pkg.version[0]))
15
- return +pkg.version[0]
16
-
17
- return 3
18
- }
19
- const isVue3 = getVueVersion() === 3
20
-
21
- /** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
22
- export const reactivityTransform = [
23
- {
24
- languageOptions: {
25
- globals: {
26
- $: 'readonly',
27
- $$: 'readonly',
28
- $ref: 'readonly',
29
- $computed: 'readonly',
30
- $shallowRef: 'readonly',
31
- $toRef: 'readonly',
32
- $customRef: 'readonly',
33
- },
34
- },
35
- plugins: {
36
- vue: vuePlugin,
37
- },
38
- rules: {
39
- 'vue/no-setup-props-reactivity-loss': 'off',
40
- },
41
- },
42
- ]
43
-
44
- /** @type {import('eslint-define-config').Rules} */
45
- const vueCustomRules = {
46
- 'vue/max-attributes-per-line': 'off',
47
- 'vue/no-v-html': 'off',
48
- 'vue/multi-word-component-names': 'off',
49
- // 'vue/require-prop-types': 'off',
50
- // 'vue/require-default-prop': 'off',
51
- // 'vue/no-dupe-keys': 'off',
52
-
53
- 'vue/array-bracket-newline': ['error', {
54
- minItems: 3,
55
- multiline: true,
56
- }],
57
- 'vue/array-bracket-spacing': ['error', 'never'],
58
- 'vue/arrow-spacing': ['error', {
59
- after: true,
60
- before: true,
61
- }],
62
- 'vue/block-spacing': ['error', 'always'],
63
- 'vue/block-tag-newline': ['error', {
64
- multiline: 'always',
65
- singleline: 'always',
66
- }],
67
- 'vue/brace-style': ['error', 'stroustrup', {
68
- allowSingleLine: true,
69
- }],
70
- 'vue/comma-dangle': ['error', 'always-multiline'],
71
- 'vue/comma-spacing': ['error', {
72
- after: true,
73
- before: false,
74
- }],
75
- 'vue/comma-style': ['error', 'last'],
76
- 'vue/component-name-in-template-casing': ['error', 'PascalCase'],
77
- 'vue/component-options-name-casing': ['error', 'PascalCase'],
78
- 'vue/block-order': ['error', {
79
- order: ['template', 'script', 'style'],
80
- }],
81
- 'vue/custom-event-name-casing': ['error', 'camelCase'],
82
- 'vue/define-macros-order': ['error', {
83
- order: ['defineOptions', 'defineProps', 'defineEmits', 'defineSlots'],
84
- }],
85
- 'vue/dot-location': ['error', 'property'],
86
- 'vue/dot-notation': ['error', {
87
- allowKeywords: true,
88
- }],
89
- 'vue/eqeqeq': ['error', 'smart'],
90
- 'vue/html-comment-content-spacing': ['error', 'always', {
91
- exceptions: ['-'],
92
- }],
93
- 'vue/html-indent': ['error', 4],
94
- // 'vue/html-self-closing': ['error', {
95
- // html: {
96
- // component: 'always',
97
- // normal: 'always',
98
- // void: 'always',
99
- // },
100
- // math: 'always',
101
- // svg: 'always',
102
- // }],
103
- 'vue/key-spacing': ['error', {
104
- afterColon: true,
105
- beforeColon: false,
106
- }],
107
- 'vue/keyword-spacing': ['error', {
108
- after: true,
109
- before: true,
110
- }],
111
- 'vue/no-constant-condition': 'warn',
112
- 'vue/no-empty-pattern': 'error',
113
- 'vue/no-extra-parens': ['error', 'functions'],
114
- 'vue/no-irregular-whitespace': 'error',
115
- 'vue/no-loss-of-precision': 'error',
116
- 'vue/no-restricted-syntax': ['error', 'DebuggerStatement', 'LabeledStatement', 'WithStatement'],
117
- 'vue/no-restricted-v-bind': ['error', '/^v-/'],
118
- 'vue/no-sparse-arrays': 'error',
119
- 'vue/no-unused-refs': 'error',
120
- 'vue/no-useless-v-bind': 'error',
121
- 'vue/object-curly-newline': ['error', {
122
- consistent: true,
123
- multiline: true,
124
- }],
125
- 'vue/object-curly-spacing': ['error', 'always'],
126
- 'vue/object-property-newline': ['error', {
127
- allowMultiplePropertiesPerLine: true,
128
- }],
129
- 'vue/object-shorthand': ['error', 'always', {
130
- avoidQuotes: true,
131
- ignoreConstructors: false,
132
- }],
133
- 'vue/operator-linebreak': ['error', 'before'],
134
- 'vue/padding-line-between-blocks': ['error', 'always'],
135
- 'vue/prefer-separate-static-class': 'error',
136
- 'vue/prefer-template': 'error',
137
- 'vue/quote-props': ['error', 'consistent-as-needed'],
138
- 'vue/require-typed-object-prop': ['error'],
139
- 'vue/space-in-parens': ['error', 'never'],
140
- 'vue/space-infix-ops': 'error',
141
- 'vue/space-unary-ops': ['error', {
142
- nonwords: false,
143
- words: true,
144
- }],
145
- 'vue/template-curly-spacing': 'error',
146
- }
147
-
148
- /** @type {import('eslint-define-config').Rules} */
149
- const vue3Rules = {
150
- ...vuePlugin.configs.base.rules,
151
- ...vuePlugin.configs['vue3-essential'].rules,
152
- ...vuePlugin.configs['vue3-strongly-recommended'].rules,
153
- ...vuePlugin.configs['vue3-recommended'].rules,
154
- }
155
-
156
- /** @type {import('eslint-define-config').Rules} */
157
- const vue2Rules = {
158
- ...vuePlugin.configs.base.rules,
159
- ...vuePlugin.configs.essential.rules,
160
- ...vuePlugin.configs['strongly-recommended'].rules,
161
- ...vuePlugin.configs.recommended.rules,
162
- }
163
-
164
- /** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
165
- export const vue = [
166
- {
167
- files: [GLOB_VUE],
168
- plugins: {
169
- 'vue': vuePlugin,
170
- '@typescript-eslint': tsPlugin,
171
- },
172
- languageOptions: {
173
- parser: vueParser,
174
- parserOptions: {
175
- parser: '@typescript-eslint/parser',
176
- sourceType: 'module',
177
- extraFileExtensions: ['.vue'],
178
- ecmaFeatures: {
179
- jsx: true,
180
- },
181
- },
182
- },
183
- processor: vuePlugin.processors['.vue'],
184
- rules: {
185
- ...typescript[0].rules,
186
- },
187
- },
188
- {
189
- plugins: {
190
- vue: vuePlugin,
191
- },
192
- rules: {
193
- ...(isVue3 ? vue3Rules : vue2Rules),
194
- ...vueCustomRules,
195
- },
196
- },
197
- ...reactivityTransform,
198
- ]
package/src/yml.js DELETED
@@ -1,26 +0,0 @@
1
- import ymlPlugin, { configs } from 'eslint-plugin-yml'
2
- import ymlParser from 'yaml-eslint-parser'
3
- import { GLOB_YAML } from './shared.js'
4
-
5
- /** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
6
- export const yml = [
7
- {
8
- files: [GLOB_YAML],
9
- plugins: {
10
- yml: ymlPlugin,
11
- },
12
- languageOptions: {
13
- parser: ymlParser,
14
- },
15
- rules: {
16
- ...configs.standard.rules,
17
-
18
- 'yml/no-empty-document': 'off',
19
- 'yml/no-empty-mapping-value': 'off',
20
- 'yml/quotes': ['error', {
21
- avoidEscape: false,
22
- prefer: 'single',
23
- }],
24
- },
25
- },
26
- ]