Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: antfu/eslint-config
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.6.2
Choose a base ref
...
head repository: antfu/eslint-config
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.6.3
Choose a head ref
  • 9 commits
  • 7 files changed
  • 4 contributors

Commits on Jan 8, 2024

  1. Verified

    This commit was signed with the committer’s verified signature.
    dtolnay David Tolnay
    Copy the full SHA
    e74d9b6 View commit details

Commits on Jan 17, 2024

  1. Copy the full SHA
    2e1117e View commit details
  2. Copy the full SHA
    187e570 View commit details
  3. chore: rules cleanup

    antfu committed Jan 17, 2024
    Copy the full SHA
    4f48899 View commit details
  4. Copy the full SHA
    20a1d6d View commit details
  5. Copy the full SHA
    9e2bf16 View commit details
  6. chore: fix type

    antfu committed Jan 17, 2024
    Copy the full SHA
    cf0c384 View commit details
  7. chore: update eslint stylistic

    antfu committed Jan 17, 2024
    Copy the full SHA
    db7f08d View commit details
  8. chore: release v2.6.3

    antfu committed Jan 17, 2024
    Copy the full SHA
    65baf20 View commit details
Showing with 464 additions and 299 deletions.
  1. +1 −1 README.md
  2. +20 −20 package.json
  3. +409 −259 pnpm-lock.yaml
  4. +0 −1 src/configs/javascript.ts
  5. +30 −15 src/configs/typescript.ts
  6. +3 −2 src/configs/vue.ts
  7. +1 −1 src/types.ts
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -192,7 +192,7 @@ export default antfu({

// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
ignores: [
'./fixtures',
'**/fixtures',
// ...globs
]
})
40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@antfu/eslint-config",
"type": "module",
"version": "2.6.2",
"packageManager": "pnpm@8.14.0",
"version": "2.6.3",
"packageManager": "pnpm@8.14.1",
"description": "Anthony's ESLint config",
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
"license": "MIT",
@@ -73,28 +73,28 @@
"@antfu/eslint-define-config": "^1.23.0-2",
"@antfu/install-pkg": "^0.3.1",
"@eslint-types/jsdoc": "46.8.2-1",
"@eslint-types/typescript-eslint": "^6.17.0",
"@eslint-types/typescript-eslint": "^6.18.1",
"@eslint-types/unicorn": "^50.0.1",
"@stylistic/eslint-plugin": "^1.5.3",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"@stylistic/eslint-plugin": "^1.5.4",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"eslint-config-flat-gitignore": "^0.1.2",
"eslint-merge-processors": "^0.1.0",
"eslint-plugin-antfu": "^2.1.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-i": "^2.29.1",
"eslint-plugin-jsdoc": "^48.0.2",
"eslint-plugin-jsonc": "^2.11.2",
"eslint-plugin-jsonc": "^2.12.2",
"eslint-plugin-markdown": "^3.0.1",
"eslint-plugin-n": "^16.6.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-perfectionist": "^2.5.0",
"eslint-plugin-toml": "^0.8.0",
"eslint-plugin-toml": "^0.9.2",
"eslint-plugin-unicorn": "^50.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
"eslint-plugin-vitest": "^0.3.20",
"eslint-plugin-vue": "^9.19.2",
"eslint-plugin-yml": "^1.11.0",
"eslint-plugin-vue": "^9.20.1",
"eslint-plugin-yml": "^1.12.2",
"eslint-processor-vue-blocks": "^0.1.1",
"globals": "^13.24.0",
"jsonc-eslint-parser": "^2.4.0",
@@ -103,24 +103,24 @@
"picocolors": "^1.0.0",
"prompts": "^2.4.2",
"toml-eslint-parser": "^0.9.3",
"vue-eslint-parser": "^9.3.2",
"vue-eslint-parser": "^9.4.0",
"yaml-eslint-parser": "^1.2.2",
"yargs": "^17.7.2"
},
"devDependencies": {
"@antfu/eslint-config": "workspace:*",
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
"@antfu/ni": "^0.21.12",
"@stylistic/eslint-plugin-migrate": "^1.5.3",
"@types/eslint": "^8.56.1",
"@stylistic/eslint-plugin-migrate": "^1.5.4",
"@types/eslint": "^8.56.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.10.7",
"@types/node": "^20.11.5",
"@types/prompts": "^2.4.9",
"@types/yargs": "^17.0.32",
"@unocss/eslint-plugin": "^0.58.3",
"bumpp": "^9.2.1",
"bumpp": "^9.3.0",
"eslint": "npm:eslint-ts-patch@^8.56.0-0",
"eslint-flat-config-viewer": "^0.1.4",
"eslint-flat-config-viewer": "^0.1.11",
"eslint-plugin-format": "^0.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
@@ -134,12 +134,12 @@
"lint-staged": "^15.2.0",
"rimraf": "^5.0.5",
"simple-git-hooks": "^2.9.0",
"svelte": "^4.2.8",
"svelte": "^4.2.9",
"svelte-eslint-parser": "^0.33.1",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"vitest": "^1.1.3",
"vue": "^3.4.5"
"vitest": "^1.2.0",
"vue": "^3.4.14"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
668 changes: 409 additions & 259 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/configs/javascript.ts
Original file line number Diff line number Diff line change
@@ -90,7 +90,6 @@ export async function javascript(
'no-multi-str': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-object': 'error',
'no-new-symbol': 'error',
'no-new-wrappers': 'error',
'no-obj-calls': 'error',
45 changes: 30 additions & 15 deletions src/configs/typescript.ts
Original file line number Diff line number Diff line change
@@ -19,6 +19,10 @@ export async function typescript(
]

const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX]
const tsconfigPath = options?.tsconfigPath
? toArray(options.tsconfigPath)
: undefined
const isTypeAware = !!tsconfigPath

const typeAwareRules: FlatConfigItem['rules'] = {
'dot-notation': 'off',
@@ -42,10 +46,6 @@ export async function typescript(
'ts/unbound-method': 'error',
}

const tsconfigPath = options?.tsconfigPath
? toArray(options.tsconfigPath)
: undefined

const [
pluginTs,
parserTs,
@@ -54,23 +54,16 @@ export async function typescript(
interopDefault(import('@typescript-eslint/parser')),
] as const)

return [
{
// Install the plugins without globs, so they can be configured separately.
name: 'antfu:typescript:setup',
plugins: {
antfu: pluginAntfu,
ts: pluginTs as any,
},
},
{
function makeParser(typeAware: boolean, files: string[], ignores?: string[]): FlatConfigItem {
return {
files,
...ignores ? { ignores } : {},
languageOptions: {
parser: parserTs,
parserOptions: {
extraFileExtensions: componentExts.map(ext => `.${ext}`),
sourceType: 'module',
...tsconfigPath
...typeAware
? {
project: tsconfigPath,
tsconfigRootDir: process.cwd(),
@@ -79,6 +72,28 @@ export async function typescript(
...parserOptions as any,
},
},
name: `antfu:typescript:${typeAware ? 'type-aware-parser' : 'parser'}`,
}
}

return [
{
// Install the plugins without globs, so they can be configured separately.
name: 'antfu:typescript:setup',
plugins: {
antfu: pluginAntfu,
ts: pluginTs as any,
},
},
// assign type-aware parser for type-aware files and type-unaware parser for the rest
...isTypeAware
? [
makeParser(true, filesTypeAware),
makeParser(false, files, filesTypeAware),
]
: [makeParser(false, files)],
{
files,
name: 'antfu:typescript:rules',
rules: {
...renameRules(
5 changes: 3 additions & 2 deletions src/configs/vue.ts
Original file line number Diff line number Diff line change
@@ -83,12 +83,14 @@ export async function vue(
},

'node/prefer-global/process': 'off',

'vue/block-order': ['error', {
order: ['script', 'template', 'style'],
}],

'vue/component-name-in-template-casing': ['error', 'PascalCase'],
'vue/component-options-name-casing': ['error', 'PascalCase'],
// this is deprecated
'vue/component-tags-order': 'off',
'vue/custom-event-name-casing': ['error', 'camelCase'],
'vue/define-macros-order': ['error', {
order: ['defineOptions', 'defineProps', 'defineEmits', 'defineSlots'],
@@ -102,7 +104,6 @@ export async function vue(
'vue/multi-word-component-names': 'off',
'vue/no-dupe-keys': 'off',
'vue/no-empty-pattern': 'error',
'vue/no-extra-parens': ['error', 'functions'],
'vue/no-irregular-whitespace': 'error',
'vue/no-loss-of-precision': 'error',
'vue/no-restricted-syntax': [
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -291,7 +291,7 @@ export interface OptionsConfig extends OptionsComponentExts {
*
* @default true
*/
stylistic?: boolean | StylisticConfig
stylistic?: boolean | (StylisticConfig & OptionsOverrides)

/**
* Enable react rules.