Skip to content

feat!: add support for ESLint Flat Config; drop `.eslintrc* support #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 20 additions & 25 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,70 @@
<a name="8.0.0"></a>

## [8.0.0](https://github.com/vuejs/eslint-config-prettier/compare/v7.1.0...v8.0.0) (2023-07-20)

### Breaking Changes

* Upgraded to Prettier v3; please check out the [Prettier release blog](https://prettier.io/blog/2023/07/05/3.0.0.html) for more details
* Requires Node.js >= v14
* Requires ESLint >= v8

- Upgraded to Prettier v3; please check out the [Prettier release blog](https://prettier.io/blog/2023/07/05/3.0.0.html) for more details
- Requires Node.js >= v14
- Requires ESLint >= v8

<a name="7.1.0"></a>

## [7.1.0](https://github.com/vuejs/eslint-config-prettier/compare/v7.0.0...v7.1.0) (2023-02-21)

### New Features

* Added a `skip-formatting` ruleset [b5933a9](https://github.com/vuejs/eslint-config-prettier/commit/b5933a9)

- Added a `skip-formatting` ruleset [b5933a9](https://github.com/vuejs/eslint-config-prettier/commit/b5933a9)

<a name="7.0.0"></a>

## [7.0.0](https://github.com/vuejs/eslint-config-prettier/compare/v6.0.0...v7.0.0) (2021-12-23)

### Breaking Changes

* Updated the dependencies and simplified the usage
* We now recommend using this package along with [`@rushstack/eslint-patch`](https://www.npmjs.com/package/@rushstack/eslint-patch)

- Updated the dependencies and simplified the usage
- We now recommend using this package along with [`@rushstack/eslint-patch`](https://www.npmjs.com/package/@rushstack/eslint-patch)

<a name="6.0.0"></a>
## [6.0.0](https://github.com/vuejs/eslint-config-prettier/compare/v5.1.0...v6.0.0) (2019-11-18)

## [6.0.0](https://github.com/vuejs/eslint-config-prettier/compare/v5.1.0...v6.0.0) (2019-11-18)

### Breaking Changes

* feat!: move `eslint:recommended` to a separate `recommended` config, fixes #3. ([de7a518](https://github.com/vuejs/eslint-config-prettier/commit/de7a518))
- feat!: move `eslint:recommended` to a separate `recommended` config, fixes #3. ([de7a518](https://github.com/vuejs/eslint-config-prettier/commit/de7a518))

`eslint:recommended` is no longer included in the default configuration.
Users of old versions need to update their `extends` to use `@vue/prettier/recommended`, or `['eslint:recommended', '@vue/prettier]`.


<a name="5.1.0"></a>
## [5.1.0](https://github.com/vuejs/eslint-config-prettier/compare/v5.0.0...v5.1.0) (2019-11-17)

## [5.1.0](https://github.com/vuejs/eslint-config-prettier/compare/v5.0.0...v5.1.0) (2019-11-17)

### New Features

* Re-exports `@typescript-eslint` and `standard` configs, so that this config can be used in combination with `@vue/typescript/recommended` or `@vue/standard` ([939f722](https://github.com/vuejs/eslint-config-prettier/commit/939f722))


- Re-exports `@typescript-eslint` and `standard` configs, so that this config can be used in combination with `@vue/typescript/recommended` or `@vue/standard` ([939f722](https://github.com/vuejs/eslint-config-prettier/commit/939f722))

<a name="5.0.0"></a>
## [5.0.0](https://github.com/vuejs/eslint-config-prettier/compare/4578703...v5.0.0) (2019-07-22)

## [5.0.0](https://github.com/vuejs/eslint-config-prettier/compare/4578703...v5.0.0) (2019-07-22)

### Breaking Changes

* Update eslint-config-prettier to v6.0.0 ([0e0712f](https://github.com/vuejs/eslint-config-prettier/commit/0e0712f))
* `eslint`, `prettier` and `eslint-plugin-prettier` are now `peerDependencies`, to better conform to [the plugin loading mechanism of eslint](https://github.com/eslint/eslint/issues/3458) ([aec6c5c](https://github.com/vuejs/eslint-config-prettier/commit/aec6c5c))


- Update eslint-config-prettier to v6.0.0 ([0e0712f](https://github.com/vuejs/eslint-config-prettier/commit/0e0712f))
- `eslint`, `prettier` and `eslint-plugin-prettier` are now `peerDependencies`, to better conform to [the plugin loading mechanism of eslint](https://github.com/eslint/eslint/issues/3458) ([aec6c5c](https://github.com/vuejs/eslint-config-prettier/commit/aec6c5c))

<a name="4.0.1"></a>

## [4.0.1](https://github.com/vuejs/eslint-config-prettier/compare/3bc2a3d...4578703) (2018-11-12)

### Bug Fixes

* Also extend `eslint-config-prettier/vue`, disable `eslint-plugin-vue` rules that are not compatible with `prettier`

- Also extend `eslint-config-prettier/vue`, disable `eslint-plugin-vue` rules that are not compatible with `prettier`

<a name="4.0.0"></a>
## [4.0.0](https://github.com/vuejs/eslint-config-prettier/compare/15cf6d7...3bc2a3d) (2018-10-31)

## [4.0.0](https://github.com/vuejs/eslint-config-prettier/compare/15cf6d7...3bc2a3d) (2018-10-31)

### Beaking Changes

* Update base configs and plugins, now requires ESLint v5 as a peer dependency
- Update base configs and plugins, now requires ESLint v5 as a peer dependency
38 changes: 16 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,36 @@

> eslint-config-prettier for Vue

This config is specifically designed to be used by `@vue/cli` & `create-vue` setups
This config is specifically designed to be used by `create-vue` setups
and is not meant for outside use (it can be used but some adaptations
on the user side might be needed - for details see the config file).

A part of its design is that this config may implicitly depend on
other parts of `@vue/cli`/`create-vue` setups.
other parts of `create-vue` setups.

## Installation

Before [ESLint Flat Config](https://eslint.org/docs/latest/use/configure/configuration-files-new) becomes stable, in order to work around [a known limitation in ESLint](https://github.com/eslint/eslint/issues/3458), we recommend you to use this package alongside `@rushstack/eslint-patch`, so that you don't have to install too many dependencies:

```sh
npm add --dev @vue/eslint-config-prettier @rushstack/eslint-patch
npm add --dev @vue/eslint-config-prettier
```

Please also make sure that you have `prettier` and `eslint` installed.

## Usage

Add `"@vue/eslint-config-prettier"` to the `"extends"` array in your `.eslintrc.cjs` file. Make sure to put it **last**, so it gets the chance to override other configs.
> Note: the current version doesn't support the legacy `.eslintrc*` configuraion format. For that you need to use version 9 or earlier. See the [corresponding README](https://www.npmjs.com/package/@vue/eslint-config-prettier/v/legacy-eslintrc) for more usage instructions.

Import `@vue/eslint-config-prettier` in `eslint.config.js` (or `eslint.config.mjs`), and put it in the configuration array – &&**after** other configs that you want to override.

```js
require("@rushstack/eslint-patch/modern-module-resolution")

module.exports = {
extends: [
// ... other configs
"@vue/eslint-config-prettier"
]
}
import someConfig from "some-other-config-you-use";
import prettierConfig from "@vue/eslint-config-prettier";

export default [someConfig, prettierConfig];
```

Make sure to put it **last**, so it gets the chance to override other configs.

This configuration is the most straightward way to use ESLint with Prettier.

It disables all rules that are unnecessary or might conflict with Prettier.
Expand All @@ -51,14 +49,10 @@ Running prettier inside the linter slows down the linting process, might clutter
So we offered an additional ruleset to support this workflow:

```js
require("@rushstack/eslint-patch/modern-module-resolution")

module.exports = {
extends: [
// ... other configs
"@vue/eslint-config-prettier/skip-formatting"
]
}
import someConfig from "some-other-config-you-use";
import skipFormattingConfig from "@vue/eslint-config-prettier/skip-formatting";

export default [someConfig, skipFormattingConfig];
```

Formatting issues won't be reported with this config.
Expand Down
9 changes: 9 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import skipFormattingConfig from "./skip-formatting.js";

export default [
{
name: "app/files-to-lint",
files: ["*.js"],
},
skipFormattingConfig
];
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const recommendedConfig = require("eslint-config-prettier/recommended");

module.exports = {
plugins: ["prettier"],
extends: ["plugin:prettier/recommended"],
...recommendedConfig,
rules: {
...recommendedConfig.rules,
// should warn instead of error because formatting is not a critical issue
"prettier/prettier": "warn",
},
};
24 changes: 11 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "@vue/eslint-config-prettier",
"version": "9.0.0",
"description": "eslint-config-prettier for Vue",
"description": "eslint-config-prettier for create-vue",
"type": "commonjs",
"main": "index.js",
"files": [
"index.js",
Expand All @@ -16,7 +17,8 @@
},
"keywords": [
"vue",
"cli",
"create-vue",
"create-eslint-config",
"eslint",
"prettier"
],
Expand All @@ -27,23 +29,19 @@
},
"homepage": "https://github.com/vuejs/eslint-config-prettier#readme",
"dependencies": {
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0"
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1"
},
"devDependencies": {
"eslint": "^8.45.0",
"prettier": "^3.0.0"
"eslint": "^9.11.0",
"prettier": "^3.3.3"
},
"peerDependencies": {
"eslint": ">= 8.0.0",
"eslint": ">= 8.21.0",
"prettier": ">= 3.0.0"
},
"eslintConfig": {
"extends": [
"./index.js"
]
},
"scripts": {
"lint": "eslint *.js --fix"
"lint": "eslint . --fix",
"format": "prettier *.{js,md} --write"
}
}
Loading