Skip to content

Commit

Permalink
feat: disallow default export
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Apr 19, 2023
1 parent 5e4b9a0 commit 96211cc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import jsConfig from '@eslint/js'
import importPlugin from 'eslint-plugin-import'
import unicornPlugin from 'eslint-plugin-unicorn'
import antfuPlugin from 'eslint-plugin-antfu'
import { GLOB_SRC, GLOB_SRC_EXT } from './shared.js'

export { importPlugin, unicornPlugin, antfuPlugin }

Expand Down Expand Up @@ -144,11 +145,26 @@ export const imports = [
pathGroupsExcludedImportTypes: ['type'],
},
],
'import/no-default-export': 'error',

'antfu/import-dedupe': 'error',
'antfu/prefer-inline-type-import': 'error',
},
},
{
files: [
`**/*config*.${GLOB_SRC_EXT}`,
`**/views/${GLOB_SRC}`,
`**/pages/${GLOB_SRC}`,
`**/{index,vite,esbuild,rollup,webpack,rspack}.ts`,
],
plugins: {
import: importPlugin,
},
rules: {
'import/no-default-export': 'off',
},
},
]

/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
Expand Down
1 change: 1 addition & 0 deletions src/shared.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check

export const GLOB_SRC_EXT = '?([mt])[jt]s?(x)'
export const GLOB_SRC = '**/*.?([mt])[jt]s?(x)'

export const GLOB_JS = '**/*.?([mt])js'
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
"lib": ["es2019"],
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"moduleResolution": "nodenext",
"skipLibCheck": true,
"noUnusedLocals": true,
"resolveJsonModule": true,
"types": ["node"],
"allowJs": true,
"declaration": true,
Expand Down

0 comments on commit 96211cc

Please sign in to comment.