Skip to content

Commit

Permalink
Merge pull request #29 from Boehringer-Ingelheim/fix/perfectionist-re…
Browse files Browse the repository at this point in the history
…commended-class-groups

Reenable recommended groups configuration of perfectionist/sort-classes
  • Loading branch information
SimonGolms authored Nov 16, 2023
2 parents b58d8e1 + 8fa1e5b commit 6499702
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { SORT_IMPORTS_GROUPS } = require("../lib/eslint-plugin-perfectionist");
const { SORT_CLASSES_GROUPS, SORT_IMPORTS_GROUPS } = require("../lib/eslint-plugin-perfectionist");

/**
* Workaround to allow ESLint to resolve plugins that were installed
Expand Down Expand Up @@ -104,7 +104,7 @@ module.exports = {
// eslint-plugin-perfectionist: https://github.com/azat-io/eslint-plugin-perfectionist
"perfectionist/sort-array-includes": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-astro-attributes": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-classes": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-classes": ["error", { groups: SORT_CLASSES_GROUPS, "ignore-case": true, type: "natural" }],
"perfectionist/sort-enums": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-exports": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-imports": [
Expand Down
22 changes: 22 additions & 0 deletions lib/eslint-plugin-perfectionist.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@ const SORT_IMPORTS_GROUPS = [
"unknown",
];

/**
* This is the the groups configuration of all the recommended configs by eslint-plugin-perfectionist.
* This array can be used to reconfigure some options of the perfectionist/sort-classes rule without
* overwriting the groups configuration of this rule.
* This config can be found here:
* - https://eslint-plugin-perfectionist.azat.io/rules/sort-classes#groups
* - https://github.com/azat-io/eslint-plugin-perfectionist/blob/main/index.ts#L61
*/
const SORT_CLASSES_GROUPS = [
"index-signature",
"static-property",
"private-property",
"property",
"constructor",
"static-method",
"private-method",
"method",
["get-method", "set-method"],
"unknown",
];

module.exports = {
SORT_CLASSES_GROUPS,
SORT_IMPORTS_GROUPS,
};

0 comments on commit 6499702

Please sign in to comment.