Skip to content

Commit

Permalink
feat(eslint-config): typescript strict by default, make config names …
Browse files Browse the repository at this point in the history
…more consistent
  • Loading branch information
antfu committed Mar 29, 2024
1 parent 2efd732 commit d77ebe7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/eslint-config/src/flat/configs/disables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function disables(options: NuxtESLintConfigOptions): FlatConfigIt

if (fileRoutes.length) {
configs.push({
name: 'nuxt:vue-routes-disables',
name: 'nuxt:vue:routes:disables',
files: fileRoutes,
rules: {
'vue/multi-word-component-names': 'off',
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/src/flat/configs/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function nuxt(options: NuxtESLintConfigOptions): FlatConfigItem[]

if (fileSingleRoot.length)
configs.push({
name: 'nuxt:vue-single-root',
name: 'nuxt:vue:single-root',
files: fileSingleRoot,
rules: {
'vue/no-multiple-template-root': 'error',
Expand Down
6 changes: 4 additions & 2 deletions packages/eslint-config/src/flat/configs/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { FlatConfigItem } from 'eslint-flat-config-utils'
export default function typescript(): FlatConfigItem[] {
return [
{
name: 'nuxt:setup:typescript',
name: 'nuxt:typescript:setup',
plugins: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
'@typescript-eslint': pluginTs as any,
Expand All @@ -21,12 +21,14 @@ export default function typescript(): FlatConfigItem[] {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...pluginTs.configs['eslint-recommended'].overrides![0].rules as any,
...pluginTs.configs.recommended.rules,
...pluginTs.configs.strict.rules,

'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false, prefer: 'type-imports' }],
},
},
{
name: 'nuxt:typescript-disables',
name: 'nuxt:typescript:disables',
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts', '**/*.vue'],
rules: {
// The core 'no-unused-vars' rules (in the eslint:recommended ruleset)
Expand Down
5 changes: 1 addition & 4 deletions packages/eslint-config/src/flat/configs/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ export default function vue(options: NuxtESLintConfigOptions): FlatConfigItem[]

return [
{
name: 'nuxt:setup-vue',
name: 'nuxt:vue:setup',
plugins: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
vue: pluginVue as any,
},
},
{
name: 'nuxt:vue-language-options',
languageOptions: {
parserOptions: {
ecmaVersion: 'latest',
Expand Down
2 changes: 1 addition & 1 deletion packages/module/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@ export type Awaitable<T> = T | Promise<T>

export type ESLintConfigGenAddon = {
name: string
getConfigs: () => Awaitable<ESLintConfigGenAddonResult | void>
getConfigs: () => Awaitable<ESLintConfigGenAddonResult | undefined>
}
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
}
},
"exclude": [
"**/dist/**",
"**/node_modules/**",
"playground",
"docs"
"docs",
]
}

0 comments on commit d77ebe7

Please sign in to comment.