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.9.0
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.9.1
Choose a head ref
  • 4 commits
  • 6 files changed
  • 3 contributors

Commits on Mar 22, 2024

  1. chore: typo (#430)

    yunsii authored Mar 22, 2024

    Verified

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

Commits on Mar 26, 2024

  1. fix: support eslint v9 (#432)

    antfu authored Mar 26, 2024
    Copy the full SHA
    13c4890 View commit details
  2. feat: graphql glob that supports .qgl extensions (#433)

    tasiotas authored Mar 26, 2024
    Copy the full SHA
    f586293 View commit details
  3. chore: release v2.9.1

    antfu committed Mar 26, 2024
    Copy the full SHA
    83e0cac View commit details
Showing with 555 additions and 446 deletions.
  1. +6 −5 README.md
  2. +7 −2 eslint.config.ts → eslint.config.js
  3. +25 −26 package.json
  4. +514 −411 pnpm-lock.yaml
  5. +2 −2 src/configs/formatters.ts
  6. +1 −0 src/globs.ts
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -146,7 +146,9 @@ Add the following settings to your `.vscode/settings.json`:
"json",
"jsonc",
"yaml",
"toml"
"toml",
"gql",
"graphql"
]
}
```
@@ -295,7 +297,7 @@ type foo = { bar: 2 }
```

> [!NOTE]
> About plugin renaming - it is actually rather a dangrous move that might leading to potential naming collisions, pointed out [here](https://github.com/eslint/eslint/discussions/17766) and [here](https://github.com/prettier/eslint-config-prettier#eslintconfigjs-flat-config-plugin-caveat). As this config also very **personal** and **opinionated**, I ambitiously poisition this config as the only **"top-level"** config per project, that might pivots the taste of how rules are named.
> About plugin renaming - it is actually rather a dangrous move that might leading to potential naming collisions, pointed out [here](https://github.com/eslint/eslint/discussions/17766) and [here](https://github.com/prettier/eslint-config-prettier#eslintconfigjs-flat-config-plugin-caveat). As this config also very **personal** and **opinionated**, I ambitiously position this config as the only **"top-level"** config per project, that might pivots the taste of how rules are named.
>
> This config cares more about the user-facings DX, and try to ease out the implementation details. For example, users could keep using the semantic `import/order` without ever knowing the underlying plugin has migrated twice to `eslint-plugin-i` and then to `eslint-plugin-import-x`. User are also not forced to migrate to the implicit `i/order` halfway only because we swapped the implementation to a fork.
>
@@ -482,9 +484,9 @@ This config also provides some optional plugins/rules for extended usage.

#### `perfectionist` (sorting)

This plugin [`eslint-plugin-perfectionist`](https://github.com/azat-io/eslint-plugin-perfectionist) allows you to sorted object keys, imports, etc, with auto-fix.
This plugin [`eslint-plugin-perfectionist`](https://github.com/azat-io/eslint-plugin-perfectionist) allows you to sort object keys, imports, etc, with auto-fix.

The plugin is installed but no rules are enabled by default.
The plugin is installed, but no rules are enabled by default.

It's recommended to opt-in on each file individually using [configuration comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1).

@@ -495,7 +497,6 @@ const objectWantedToSort = {
b: 1,
c: 3,
}
/* eslint perfectionist/sort-objects: "off" */
```

### Type Aware Rules
9 changes: 7 additions & 2 deletions eslint.config.ts → eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// @ts-expect-error missing types
import styleMigrate from '@stylistic/eslint-plugin-migrate'
import antfu from './src'
import JITI from 'jiti'

const jiti = JITI(import.meta.url)
/**
* @type {import('./src').default}
*/
const antfu = jiti('./src').default

export default antfu(
{
51 changes: 25 additions & 26 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.9.0",
"packageManager": "pnpm@8.15.4",
"version": "2.9.1",
"packageManager": "pnpm@8.15.5",
"description": "Anthony's ESLint config",
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
"license": "MIT",
@@ -45,7 +45,7 @@
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.4",
"eslint-plugin-svelte": "^2.34.1",
"eslint-plugin-svelte": "^2.36.0-0",
"prettier-plugin-astro": "^0.13.0",
"prettier-plugin-slidev": "^1.0.5",
"svelte-eslint-parser": "^0.33.1"
@@ -90,30 +90,30 @@
"@antfu/install-pkg": "^0.3.1",
"@clack/prompts": "^0.7.0",
"@eslint-types/jsdoc": "46.8.2-1",
"@eslint-types/typescript-eslint": "^7.0.2",
"@eslint-types/typescript-eslint": "^7.2.0",
"@eslint-types/unicorn": "^51.0.1",
"@stylistic/eslint-plugin": "^1.7.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"eslint-config-flat-gitignore": "^0.1.3",
"eslint-merge-processors": "^0.1.0",
"eslint-plugin-antfu": "^2.1.2",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import-x": "^0.4.1",
"eslint-plugin-import-x": "^0.4.4",
"eslint-plugin-jsdoc": "^48.2.1",
"eslint-plugin-jsonc": "^2.13.0",
"eslint-plugin-jsonc": "^2.14.1",
"eslint-plugin-markdown": "^4.0.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-perfectionist": "^2.6.0",
"eslint-plugin-toml": "^0.9.2",
"eslint-plugin-perfectionist": "^2.7.0",
"eslint-plugin-toml": "^0.10.0",
"eslint-plugin-unicorn": "^51.0.1",
"eslint-plugin-unused-imports": "^3.1.0",
"eslint-plugin-vitest": "^0.3.26",
"eslint-plugin-vue": "^9.23.0",
"eslint-plugin-yml": "^1.12.2",
"eslint-plugin-vitest": "^0.4.0",
"eslint-plugin-vue": "^9.24.0",
"eslint-plugin-yml": "^1.13.2",
"eslint-processor-vue-blocks": "^0.1.1",
"globals": "^14.0.0",
"globals": "^15.0.0",
"jsonc-eslint-parser": "^2.4.0",
"local-pkg": "^0.5.0",
"parse-gitignore": "^2.0.0",
@@ -128,23 +128,22 @@
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
"@antfu/ni": "^0.21.12",
"@stylistic/eslint-plugin-migrate": "^1.7.0",
"@types/eslint": "^8.56.5",
"@types/eslint": "^8.56.6",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.11.27",
"@types/node": "^20.11.30",
"@types/prompts": "^2.4.9",
"@types/yargs": "^17.0.32",
"@unocss/eslint-plugin": "^0.58.5",
"@unocss/eslint-plugin": "^0.58.7",
"astro-eslint-parser": "^0.16.3",
"bumpp": "^9.4.0",
"eslint": "npm:eslint-ts-patch@^8.57.0-0",
"eslint-flat-config-viewer": "^0.1.11",
"eslint-plugin-astro": "^0.31.4",
"eslint": "9.0.0-rc.0",
"eslint-flat-config-viewer": "^0.1.14",
"eslint-plugin-astro": "^0.33.1",
"eslint-plugin-format": "^0.1.0",
"eslint-plugin-react": "^7.34.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"eslint-plugin-svelte": "^2.35.1",
"eslint-ts-patch": "^8.57.0-0",
"eslint-plugin-svelte": "2.36.0-next.12",
"esno": "^4.7.0",
"execa": "^8.0.1",
"fast-glob": "^3.3.2",
@@ -153,12 +152,12 @@
"prettier-plugin-astro": "^0.13.0",
"prettier-plugin-slidev": "^1.0.5",
"rimraf": "^5.0.5",
"simple-git-hooks": "^2.10.0",
"simple-git-hooks": "^2.11.1",
"svelte": "^4.2.12",
"svelte-eslint-parser": "^0.33.1",
"tsup": "^8.0.2",
"typescript": "^5.4.2",
"vitest": "^1.3.1",
"typescript": "^5.4.3",
"vitest": "^1.4.0",
"vue": "^3.4.21"
},
"simple-git-hooks": {
925 changes: 514 additions & 411 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/configs/formatters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isPackageExists } from 'local-pkg'
import { GLOB_ASTRO, GLOB_CSS, GLOB_LESS, GLOB_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS } from '../globs'
import { GLOB_ASTRO, GLOB_CSS, GLOB_GRAPHQL, GLOB_LESS, GLOB_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS } from '../globs'
import type { VendoredPrettierOptions } from '../vender/prettier-types'
import { ensurePackages, interopDefault, parserPlain } from '../utils'
import type { FlatConfigItem, OptionsFormatters, StylisticConfig } from '../types'
@@ -227,7 +227,7 @@ export async function formatters(

if (options.graphql) {
configs.push({
files: ['**/*.graphql'],
files: [GLOB_GRAPHQL],
languageOptions: {
parser: parserPlain,
},
1 change: 1 addition & 0 deletions src/globs.ts
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ export const GLOB_YAML = '**/*.y?(a)ml'
export const GLOB_TOML = '**/*.toml'
export const GLOB_HTML = '**/*.htm?(l)'
export const GLOB_ASTRO = '**/*.astro'
export const GLOB_GRAPHQL = '**/*.{g,graph}ql'

export const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`