Skip to content

Commit

Permalink
feat: Use perfectionist plugin for sorting rules (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-j-castro authored Oct 12, 2024
1 parent b058c1c commit eb4aeb0
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 309 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module.exports = {
extends: "./index.js",
root: true,
rules: {
"sort-keys": "error",
"perfectionist/sort-objects": "error",
},
};
70 changes: 42 additions & 28 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:perfectionist/recommended-alphabetical-legacy",
"plugin:@stylistic/disable-legacy",
"plugin:prettier/recommended",
],
Expand All @@ -18,13 +19,7 @@ module.exports = {
},
],
parser: "@typescript-eslint/parser",
plugins: [
"@stylistic",
"@typescript-eslint",
"prettier",
"sort-destructure-keys",
"typescript-sort-keys",
],
plugins: ["@stylistic", "@typescript-eslint", "prettier", "perfectionist"],
rules: {
"@stylistic/jsx-self-closing-comp": [
"error",
Expand All @@ -33,7 +28,6 @@ module.exports = {
html: true,
},
],
"@stylistic/jsx-sort-props": ["error", { shorthandLast: true }],
"@stylistic/padding-line-between-statements": [
"error",
{ blankLine: "always", next: "*", prev: ["case", "default"] },
Expand All @@ -46,21 +40,12 @@ module.exports = {
{ allowTemplateLiterals: false, avoidEscape: true },
],
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/sort-type-constituents": "error",
"arrow-body-style": ["error", "as-needed"],
curly: ["error", "all"],
"import/newline-after-import": "error",
"import/no-named-as-default": "off",
"import/no-relative-packages": "error",
"import/no-unresolved": "error",
"import/order": [
"error",
{
alphabetize: { order: "asc" },
groups: ["builtin", "external", "internal", "sibling", "index"],
"newlines-between": "never",
},
],
"no-console": "error",
"no-restricted-imports": [
"warn",
Expand All @@ -73,30 +58,59 @@ module.exports = {
],
},
],
"prettier/prettier": "error",
"react/jsx-no-useless-fragment": "error",
"sort-destructure-keys/sort-destructure-keys": [
"perfectionist/sort-imports": [
"error",
{ caseSensitive: true },
{
groups: [
"builtin",
"external",
"internal",
"sibling",
"index",
"unknown",
"side-effect-style",
],
newlinesBetween: "never",
},
],
"sort-imports": ["error", { ignoreDeclarationSort: true }],
"typescript-sort-keys/interface": [
"perfectionist/sort-interfaces": ["error", { groupKind: "required-first" }],
"perfectionist/sort-intersection-types": [
"error",
"asc",
{ caseSensitive: true, natural: true, requiredFirst: true },
{
groups: ["unknown", "object"],
},
],
"typescript-sort-keys/string-enum": [
"perfectionist/sort-jsx-props": [
"error",
"asc",
{ caseSensitive: true, natural: true },
{
groups: ["unknown", "shorthand"],
},
],
"perfectionist/sort-object-types": [
"error",
{ groupKind: "required-first" },
],
"perfectionist/sort-objects": "off",
"perfectionist/sort-union-types": [
"error",
{
groups: ["unknown", "nullish"],
},
],
"prettier/prettier": "error",
"react/jsx-no-useless-fragment": "error",
},
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
perfectionist: {
ignoreCase: false,
order: "asc",
type: "alphabetical",
},
react: {
version: "detect",
},
Expand Down
Loading

0 comments on commit eb4aeb0

Please sign in to comment.