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: prettier/eslint-plugin-prettier
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.1.3
Choose a base ref
...
head repository: prettier/eslint-plugin-prettier
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.2.1
Choose a head ref
  • 7 commits
  • 8 files changed
  • 6 contributors

Commits on Apr 9, 2024

  1. feat: support parsing html via @html-eslint/parser natively (#652)

    Co-authored-by: JounQin <admin@1stg.me>
    Logicer16 and JounQin authored Apr 9, 2024
    Copy the full SHA
    f170011 View commit details
  2. chore: release eslint-plugin-prettier (#653)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored Apr 9, 2024
    1
    Copy the full SHA
    02c21a5 View commit details

Commits on Jun 1, 2024

  1. build(deps): Bump pnpm/action-setup from 2 to 4 in the actions group (#…

    …661)
    
    Bumps the actions group with 1 update: [pnpm/action-setup](https://github.com/pnpm/action-setup).
    
    
    Updates `pnpm/action-setup` from 2 to 4
    - [Release notes](https://github.com/pnpm/action-setup/releases)
    - [Commits](pnpm/action-setup@v2...v4)
    
    ---
    updated-dependencies:
    - dependency-name: pnpm/action-setup
      dependency-type: direct:production
      update-type: version-update:semver-major
      dependency-group: actions
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jun 1, 2024
    Copy the full SHA
    de9751c View commit details

Commits on Jun 22, 2024

  1. build(deps): Bump braces from 3.0.2 to 3.0.3 (#665)

    Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
    - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
    - [Commits](micromatch/braces@3.0.2...3.0.3)
    
    ---
    updated-dependencies:
    - dependency-name: braces
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jun 22, 2024
    Copy the full SHA
    a1e6f4a View commit details

Commits on Jul 17, 2024

  1. build(deps): Bump synckit from 0.8.6 to 0.9.1 (#668)

    Co-authored-by: JounQin <admin@1stg.me>
    OrlovAlexei and JounQin authored Jul 17, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ac036cc View commit details
  2. chore: release eslint-plugin-prettier (#669)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored Jul 17, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    24288c7 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    51324d9 View commit details
Showing with 173 additions and 16 deletions.
  1. +1 −1 .github/workflows/ci.yml
  2. +1 −1 .github/workflows/release.yml
  3. +12 −0 CHANGELOG.md
  4. +3 −2 package.json
  5. +95 −9 pnpm-lock.yaml
  6. +9 −0 test/fixtures/html.html
  7. +39 −0 test/prettier.js
  8. +13 −3 worker.js
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 5.2.1

### Patch Changes

- [#668](https://github.com/prettier/eslint-plugin-prettier/pull/668) [`ac036cc`](https://github.com/prettier/eslint-plugin-prettier/commit/ac036cca2bed4ceb6ee5b63c945426308e36c586) Thanks [@OrlovAlexei](https://github.com/OrlovAlexei)! - build(deps): Bump synckit from 0.8.6 to 0.9.1

## 5.2.0

### Minor Changes

- [#652](https://github.com/prettier/eslint-plugin-prettier/pull/652) [`f170011`](https://github.com/prettier/eslint-plugin-prettier/commit/f1700110b4c50f43bbda8dba51ce9e22248939fa) Thanks [@Logicer16](https://github.com/Logicer16)! - feat: support parsing `html` via `@html-eslint/parser` natively

## 5.1.3

### Patch Changes
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-prettier",
"version": "5.1.3",
"version": "5.2.1",
"description": "Runs prettier as an eslint rule",
"repository": "git+https://github.com/prettier/eslint-plugin-prettier.git",
"homepage": "https://github.com/prettier/eslint-plugin-prettier#readme",
@@ -64,7 +64,7 @@
},
"dependencies": {
"prettier-linter-helpers": "^1.0.0",
"synckit": "^0.8.6"
"synckit": "^0.9.1"
},
"devDependencies": {
"@1stg/remark-preset": "^2.0.0",
@@ -74,6 +74,7 @@
"@eslint-community/eslint-plugin-eslint-comments": "^4.1.0",
"@eslint/js": "^8.56.0",
"@graphql-eslint/eslint-plugin": "^3.20.1",
"@html-eslint/parser": "^0.24.1",
"@prettier/plugin-pug": "^3.0.0",
"@types/eslint": "^8.56.0",
"@types/prettier-linter-helpers": "^1.0.4",
104 changes: 95 additions & 9 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions test/fixtures/html.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!doctype html>
<html>
<head>

</head>
<body>

</body>
</html>
39 changes: 39 additions & 0 deletions test/prettier.js
Original file line number Diff line number Diff line change
@@ -52,6 +52,10 @@ const eslint = new ESLint({
],
},
},
{
files: ['*.html'],
parser: '@html-eslint/parser',
},
{
files: ['*.{md,mdx}'],
extends: 'plugin:mdx/recommended',
@@ -216,6 +220,41 @@ eslintPluginGraphqlRuleTester.run('eslint-plugin-graphql', rule, {
invalid: [],
});

runFixture('*.html', [
[
{
column: 1,
endColumn: 1,
endLine: 5,
fix: {
range: [23, 31],
text: ' <head> ',
},
line: 3,
message: 'Replace `<head>⏎⏎` with `··<head>·`',
messageId: 'replace',
nodeType: null,
ruleId: 'prettier/prettier',
severity: 2,
},
{
column: 1,
endColumn: 1,
endLine: 8,
fix: {
range: [39, 47],
text: ' <body>',
},
line: 6,
message: 'Replace `<body>⏎⏎` with `··<body>`',
messageId: 'replace',
nodeType: null,
ruleId: 'prettier/prettier',
severity: 2,
},
],
]);

const mdxRuleTester = new RuleTester({
parser: require.resolve('eslint-mdx'),
parserOptions: {
16 changes: 13 additions & 3 deletions worker.js
Original file line number Diff line number Diff line change
@@ -96,9 +96,7 @@ runAsWorker(
// 2. `eslint-plugin-html`
// 3. `eslint-plugin-markdown@1` (replacement: `eslint-plugin-markdown@2+`)
// 4. `eslint-plugin-svelte3` (replacement: `eslint-plugin-svelte@2+`)
const parserBlocklist = ['html'];

let inferParserToBabel = parserBlocklist.includes(initialOptions.parser);
let inferParserToBabel = false;

switch (inferredParser) {
// it could be processed by `@graphql-eslint/eslint-plugin` or `eslint-plugin-graphql`
@@ -111,6 +109,18 @@ runAsWorker(
}
break;
}
case 'html': {
// it could be processed by `eslint-plugin-html` or correctly parsed by `@html-eslint/parser`
if (
(typeof parserMeta !== 'undefined' &&
parserMeta.name !== '@html-eslint/parser') ||
(typeof parserPath === 'string' &&
!/([\\/])@html-eslint\1parser\1/.test(parserPath))
) {
inferParserToBabel = true;
}
break;
}
case 'markdown': {
// it could be processed by `eslint-plugin-markdown@1` or correctly parsed by `eslint-mdx`
if (