Skip to content

Commit

Permalink
fix: rule order-properties not work (#315)
Browse files Browse the repository at this point in the history
<!-- πŸ‘‹ Hi, thanks for sending a PR to eslint-plugin-package-json! πŸ’–.
Please fill out all fields below and make sure each item is true and [x]
checked.
Otherwise we may not be able to review your PR. -->

## PR Checklist

-   [ ] Addresses an existing open issue: fixes #000
- [ ] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

<!-- Description of what is changed and how the code change does that.
-->

Just a quick fix. I don't know why this worked before.
  • Loading branch information
hyoban authored Apr 29, 2024
1 parent d91bb01 commit 3a477f5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/rules/order-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ export const rule = createRule<Options>({
"Package top-level properties are not ordered in the npm standard way. Run the ESLint auto-fixer to correct.",
node: context.sourceCode.ast,
});
break;
}

break;
}
},
};
Expand Down
31 changes: 31 additions & 0 deletions src/tests/rules/order-properties.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,37 @@ ruleTester.run("order-properties", rule, {
},
"main": "index.js"
}
`,
},
{
code: `{
"name": "error-not-started-at-first",
"main": "index.js",
"homepage": "https://example.com",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "git+https://github.com/fake/github.git"
}
}
`,
errors: [
{
message:
"Package top-level properties are not ordered in the npm standard way. Run the ESLint auto-fixer to correct.",
},
],
filename: "package.json",
output: `{
"name": "error-not-started-at-first",
"version": "1.0.0",
"homepage": "https://example.com",
"repository": {
"type": "git",
"url": "git+https://github.com/fake/github.git"
},
"main": "index.js"
}
`,
},
{
Expand Down

0 comments on commit 3a477f5

Please sign in to comment.