@st1ggy/linter-config 7.4.0 → 9.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/README.md +101 -28
- package/data/linter-config-inventory.json +294 -128
- package/data/oxlint-config-inventory.json +913 -735
- package/data/oxlint-rule-map.json +4684 -1743
- package/data/oxlint-source-inventory.json +10529 -8546
- package/docs/OXLINT_RULE_MAPPING.md +197 -88
- package/docs/RULE_MAPPING.md +2 -2
- package/package.json +122 -18
- package/scripts/README.md +12 -5
- package/scripts/init-angular-ox.sh +4 -0
- package/scripts/init-nuxt-ox.sh +4 -0
- package/scripts/init-vue-ox.sh +4 -0
- package/scripts/linter-init-core.mjs +75 -20
- package/scripts/linter-init.mjs +5 -3
- package/src/eslint/configs/config.import.js +1 -1
- package/src/eslint/configs/config.react.js +17 -24
- package/src/eslint/configs/import-plugin.js +48 -0
- package/src/eslint/configs/svelte-stack.js +4 -11
- package/src/eslint/eslint.config.angular-ox.js +26 -0
- package/src/eslint/eslint.config.astro-ox.js +3 -0
- package/src/eslint/eslint.config.nuxt-ox.js +4 -0
- package/src/eslint/eslint.config.svelte-ox.js +4 -0
- package/src/eslint/eslint.config.vue-ox.js +17 -0
- package/src/eslint/ox-supplement.d.ts +39 -0
- package/src/oxfmt/index.d.ts +32 -0
- package/src/oxfmt/oxfmt.config.angular.js +3 -0
- package/src/oxfmt/oxfmt.config.astro.js +3 -0
- package/src/oxfmt/oxfmt.config.common.js +16 -0
- package/src/oxfmt/oxfmt.config.svelte.js +3 -0
- package/src/oxlint/configs/config.astro.js +89 -42
- package/src/oxlint/configs/config.common.js +73 -28
- package/src/oxlint/configs/config.next.js +330 -173
- package/src/oxlint/configs/config.react.js +330 -173
- package/src/oxlint/configs/config.solid.js +105 -47
- package/src/oxlint/configs/config.svelte.js +85 -61
- package/src/oxlint/create-config.js +1 -1
- package/src/oxlint/framework-rules.js +79 -0
- package/src/oxlint/index.d.ts +24 -0
- package/src/oxlint/oxlint.config.angular.js +14 -0
- package/src/oxlint/oxlint.config.nuxt.js +24 -0
- package/src/oxlint/oxlint.config.vue.js +8 -0
- package/src/oxlint/plugins/angular.js +1 -0
- package/src/oxlint/plugins/import-x.js +1 -1
- package/src/oxlint/plugins/nuxt.js +1 -0
- package/src/oxlint/plugins/react.js +1 -1
- package/src/oxlint/stacks.js +30 -5
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import importPlugin, { flatConfigs as importConfigs, rules as importRules } from 'eslint-plugin-import-x'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import process from 'node:process'
|
|
4
|
+
|
|
5
|
+
function aliasContext(context) {
|
|
6
|
+
const aliases = context.settings['st1ggy/import-aliases']
|
|
7
|
+
|
|
8
|
+
if (!aliases) {
|
|
9
|
+
return context
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const settings = context.settings
|
|
13
|
+
const resolvers = settings['import-x/resolver'] ?? {}
|
|
14
|
+
const typescript = typeof resolvers.typescript === 'object' ? resolvers.typescript : {}
|
|
15
|
+
const alias = Object.fromEntries(
|
|
16
|
+
Object.entries(aliases).map(([name, target]) => [name, [path.resolve(context.cwd ?? process.cwd(), target)]]),
|
|
17
|
+
)
|
|
18
|
+
const wrapped = Object.create(context)
|
|
19
|
+
|
|
20
|
+
Object.defineProperty(wrapped, 'settings', {
|
|
21
|
+
value: {
|
|
22
|
+
...settings,
|
|
23
|
+
'import-x/resolver': { ...resolvers, typescript: { ...typescript, alias: { ...alias, ...typescript.alias } } },
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
return wrapped
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const plugin = {
|
|
31
|
+
...importPlugin,
|
|
32
|
+
rules: Object.fromEntries(
|
|
33
|
+
Object.entries(importRules).map(([name, rule]) => [
|
|
34
|
+
name,
|
|
35
|
+
{ ...rule, create: (context) => rule.create(aliasContext(context)) },
|
|
36
|
+
]),
|
|
37
|
+
),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const flatConfigs = Object.fromEntries(
|
|
41
|
+
Object.entries(importConfigs).map(([name, config]) => [
|
|
42
|
+
name,
|
|
43
|
+
{ ...config, ...(config.plugins && { plugins: { ...config.plugins, 'import-x': plugin } }) },
|
|
44
|
+
]),
|
|
45
|
+
)
|
|
46
|
+
export const rules = plugin.rules
|
|
47
|
+
|
|
48
|
+
export default plugin
|
|
@@ -4,8 +4,6 @@ import { parser } from 'typescript-eslint'
|
|
|
4
4
|
|
|
5
5
|
const svelteFiles = ['**/*.svelte', '**/*.svelte.ts']
|
|
6
6
|
|
|
7
|
-
const extensions = ['.js']
|
|
8
|
-
|
|
9
7
|
export default defineConfig([
|
|
10
8
|
sveltePlugin.configs['flat/recommended'],
|
|
11
9
|
{
|
|
@@ -22,15 +20,10 @@ export default defineConfig([
|
|
|
22
20
|
},
|
|
23
21
|
},
|
|
24
22
|
settings: {
|
|
25
|
-
'import-
|
|
26
|
-
'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
$app: 'node_modules/@sveltejs/kit/src/runtime/app',
|
|
30
|
-
'@sveltejs/kit': 'node_modules/@sveltejs/kit/src/exports/index.js',
|
|
31
|
-
},
|
|
32
|
-
extensions,
|
|
33
|
-
},
|
|
23
|
+
'st1ggy/import-aliases': {
|
|
24
|
+
$lib: 'src/lib',
|
|
25
|
+
$app: 'node_modules/@sveltejs/kit/src/runtime/app',
|
|
26
|
+
'@sveltejs/kit': 'node_modules/@sveltejs/kit/src/exports/index.js',
|
|
34
27
|
},
|
|
35
28
|
},
|
|
36
29
|
},
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import template from '@angular-eslint/eslint-plugin-template'
|
|
2
|
+
import * as templateParser from '@angular-eslint/template-parser'
|
|
3
|
+
import { parser } from 'typescript-eslint'
|
|
4
|
+
|
|
5
|
+
import { recommendedAngularRules } from '../oxlint/framework-rules.js'
|
|
6
|
+
|
|
7
|
+
const accessibility = Object.fromEntries(
|
|
8
|
+
Object.entries(template.rules)
|
|
9
|
+
.filter(([, rule]) => rule.meta.docs?.description.startsWith('[Accessibility]'))
|
|
10
|
+
.map(([name]) => [`@angular-eslint/template/${name}`, 'error']),
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
export default [
|
|
14
|
+
{ ignores: ['**/node_modules/**', '**/.angular/**', '**/dist/**'] },
|
|
15
|
+
{
|
|
16
|
+
files: ['**/*.ts'],
|
|
17
|
+
languageOptions: { parser },
|
|
18
|
+
processor: template.processors['extract-inline-html'],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
files: ['**/*.html'],
|
|
22
|
+
languageOptions: { parser: templateParser },
|
|
23
|
+
plugins: { '@angular-eslint/template': template },
|
|
24
|
+
rules: { ...recommendedAngularRules(template, '@angular-eslint/template'), ...accessibility },
|
|
25
|
+
},
|
|
26
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import prettier from 'eslint-config-prettier'
|
|
2
|
+
import vue from 'eslint-plugin-vue'
|
|
3
|
+
import { parser } from 'typescript-eslint'
|
|
4
|
+
|
|
5
|
+
import { vueRules } from '../oxlint/framework-rules.js'
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{ ignores: ['**/node_modules/**', '**/dist/**'] },
|
|
9
|
+
...vue.configs['flat/recommended'],
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.vue'],
|
|
12
|
+
languageOptions: { parserOptions: { parser } },
|
|
13
|
+
},
|
|
14
|
+
// Oxfmt owns formatting. Keep Vue's framework checks, including template bindings.
|
|
15
|
+
prettier,
|
|
16
|
+
{ files: ['**/*.vue'], rules: Object.fromEntries(Object.keys(vueRules).map((name) => [name, 'off'])) },
|
|
17
|
+
]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare module '@st1ggy/linter-config/eslint-svelte-ox' {
|
|
2
|
+
import type { Linter } from 'eslint'
|
|
3
|
+
|
|
4
|
+
const config: Linter.Config[]
|
|
5
|
+
|
|
6
|
+
export default config
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module '@st1ggy/linter-config/eslint-astro-ox' {
|
|
10
|
+
import type { Linter } from 'eslint'
|
|
11
|
+
|
|
12
|
+
const config: Linter.Config[]
|
|
13
|
+
|
|
14
|
+
export default config
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare module '@st1ggy/linter-config/eslint-angular-ox' {
|
|
18
|
+
import type { Linter } from 'eslint'
|
|
19
|
+
|
|
20
|
+
const config: Linter.Config[]
|
|
21
|
+
|
|
22
|
+
export default config
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare module '@st1ggy/linter-config/eslint-vue-ox' {
|
|
26
|
+
import type { Linter } from 'eslint'
|
|
27
|
+
|
|
28
|
+
const config: Linter.Config[]
|
|
29
|
+
|
|
30
|
+
export default config
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare module '@st1ggy/linter-config/eslint-nuxt-ox' {
|
|
34
|
+
import type { Linter } from 'eslint'
|
|
35
|
+
|
|
36
|
+
const config: Linter.Config[]
|
|
37
|
+
|
|
38
|
+
export default config
|
|
39
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Kept separate from the legacy declarations to make the formatter an optional peer.
|
|
2
|
+
declare module '@st1ggy/linter-config/oxfmt-svelte' {
|
|
3
|
+
import type { OxfmtConfig } from 'oxfmt'
|
|
4
|
+
|
|
5
|
+
const config: OxfmtConfig
|
|
6
|
+
|
|
7
|
+
export default config
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare module '@st1ggy/linter-config/oxfmt-astro' {
|
|
11
|
+
import type { OxfmtConfig } from 'oxfmt'
|
|
12
|
+
|
|
13
|
+
const config: OxfmtConfig
|
|
14
|
+
|
|
15
|
+
export default config
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare module '@st1ggy/linter-config/oxfmt-angular' {
|
|
19
|
+
import type { OxfmtConfig } from 'oxfmt'
|
|
20
|
+
|
|
21
|
+
const config: OxfmtConfig
|
|
22
|
+
|
|
23
|
+
export default config
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare module '@st1ggy/linter-config/oxfmt-common' {
|
|
27
|
+
import type { OxfmtConfig } from 'oxfmt'
|
|
28
|
+
|
|
29
|
+
const config: OxfmtConfig
|
|
30
|
+
|
|
31
|
+
export default config
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
useTabs: false,
|
|
3
|
+
printWidth: 120,
|
|
4
|
+
tabWidth: 2,
|
|
5
|
+
semi: false,
|
|
6
|
+
singleQuote: true,
|
|
7
|
+
trailingComma: 'all',
|
|
8
|
+
bracketSpacing: true,
|
|
9
|
+
arrowParens: 'always',
|
|
10
|
+
proseWrap: 'never',
|
|
11
|
+
endOfLine: 'lf',
|
|
12
|
+
insertFinalNewline: true,
|
|
13
|
+
sortImports: false,
|
|
14
|
+
sortPackageJson: false,
|
|
15
|
+
ignorePatterns: ['**/node_modules/**', '**/.git/**'],
|
|
16
|
+
}
|