Skip to content

Commit 5e4ff28

Browse files
committed
feat: 🎸 add perfectionnist to eslint config
✅ Closes: #251
1 parent ce4207d commit 5e4ff28

File tree

3 files changed

+45
-19
lines changed

3 files changed

+45
-19
lines changed

‎hackathon/spacecraft/.eslintrc.js

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,57 @@ module.exports = {
22
env: {
33
node: true,
44
},
5-
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
6-
root: true, // make sure eslint picks up the config at the root of the directory
75
extends: [
86
"expo",
97
"eslint:recommended", // ESLint rules
108
"plugin:@typescript-eslint/recommended", // TypeScript rules
119
"plugin:react/recommended", // React rules
12-
"plugin:react/jsx-runtime", // support for React 17 JSX
10+
"plugin:react/jsx-runtime", // Support for React 17 JSX
1311
"plugin:prettier/recommended", // Prettier recommended rules
1412
],
15-
plugins: ["react", "react-native", "simple-import-sort"], // add React and React Native plugins
13+
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
14+
plugins: [
15+
"react",
16+
"react-native",
17+
"simple-import-sort",
18+
"perfectionist", // Existing plugins plus 'perfectionist'
19+
],
20+
root: true, // Make sure eslint picks up the config at the root of the directory
1621
rules: {
17-
camelcase: "off", // disable camelcase rule
18-
"@typescript-eslint/no-explicit-any": "warn", // detect usage of `any` type
22+
"@typescript-eslint/no-explicit-any": "warn", // Detect usage of `any` type
23+
"@typescript-eslint/no-unused-vars": "warn", // Detect unused variables
24+
camelcase: "off", // Disable camelcase rule
25+
"perfectionist/sort-imports": "error", // Previous perfectionist rule
26+
"perfectionist/sort-interfaces": ["error"], // New perfectionist rule
27+
"perfectionist/sort-objects": ["error", { type: "alphabetical" }], // New perfectionist rule
1928
"prettier/prettier": [
20-
// Prettier rules
2129
"warn",
2230
{
2331
usePrettierrc: true,
2432
},
2533
],
26-
"react-native/no-color-literals": 2, // enforce color literals are not used
27-
"react-native/no-unused-styles": 2, // detect unused StyleSheet rules
28-
"react-native/no-raw-text": 0, // detect raw text outside of Text component
29-
"react-native/sort-styles": 2, // enforce style definitions are sorted
30-
"@typescript-eslint/no-unused-vars": "warn", // detect unused variables
31-
"simple-import-sort/exports": "warn", // enforce sorting exports within module
34+
"react-native/no-color-literals": 2, // Enforce color literals are not used
35+
"react-native/no-raw-text": 0, // Detect raw text outside of Text component
36+
"react-native/no-unused-styles": 2, // Detect unused StyleSheet rules
37+
"react-native/sort-styles": 2, // Enforce style definitions are sorted
38+
"simple-import-sort/exports": "warn", // Enforce sorting exports within module
3239
"simple-import-sort/imports": [
3340
"warn",
3441
{
3542
groups: [
36-
// Side effect imports.
3743
["^\\u0000"],
38-
// Packages `react` related packages come first.
3944
["^react", "^@?\\w"],
40-
// Environment variables
4145
["^(@env)(/.*|$)"],
42-
// Parent imports. Put `..` last.
4346
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
44-
// Other relative imports. Put same-folder imports and `.` last.
4547
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
4648
],
4749
},
4850
],
4951
},
52+
settings: {
53+
perfectionist: {
54+
partitionByComment: true,
55+
type: "line-length",
56+
},
57+
},
5058
};

‎hackathon/spacecraft/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"eslint-config-react-native-wcandillon": "^3.9.0",
9696
"eslint-import-resolver-babel-plugin-root-import": "^1.1.1",
9797
"eslint-plugin-import": "^2.29.1",
98+
"eslint-plugin-perfectionist": "^3.3.0",
9899
"eslint-plugin-prettier": "^5.1.3",
99100
"eslint-plugin-react": "^7.34.2",
100101
"eslint-plugin-react-native": "^4.1.0",

‎hackathon/spacecraft/yarn.lock

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5567,7 +5567,7 @@
55675567
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.18.0.tgz#b90a57ccdea71797ffffa0321e744f379ec838c9"
55685568
integrity sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==
55695569

5570-
"@typescript-eslint/[email protected]":
5570+
"@typescript-eslint/[email protected]", "@typescript-eslint/types@^8.3.0":
55715571
version "8.3.0"
55725572
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.3.0.tgz#378e62447c2d7028236e55a81d3391026600563b"
55735573
integrity sha512-y6sSEeK+facMaAyixM36dQ5NVXTnKWunfD1Ft4xraYqxP0lC0POJmIaL/mw72CUMqjY9qfyVfXafMeaUj0noWw==
@@ -9043,6 +9043,16 @@ eslint-plugin-jest@^26.5.3:
90439043
dependencies:
90449044
"@typescript-eslint/utils" "^5.10.0"
90459045

9046+
eslint-plugin-perfectionist@^3.3.0:
9047+
version "3.3.0"
9048+
resolved "https://registry.yarnpkg.com/eslint-plugin-perfectionist/-/eslint-plugin-perfectionist-3.3.0.tgz#c050fc3413d8aa023bbaca4453f47b411ae84c3d"
9049+
integrity sha512-sGgShkEqDBqIZ3WlenGHwLe1cl3vHKTfeh9b1XXAamaxSC7AY4Os0jdNCXnGJW4l0TlpismT5t2r7CXY7sfKlw==
9050+
dependencies:
9051+
"@typescript-eslint/types" "^8.3.0"
9052+
"@typescript-eslint/utils" "^8.3.0"
9053+
minimatch "^10.0.1"
9054+
natural-compare-lite "^1.4.0"
9055+
90469056
eslint-plugin-prettier@^4.2.1:
90479057
version "4.2.1"
90489058
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"
@@ -13004,6 +13014,13 @@ minimalistic-crypto-utils@^1.0.1:
1300413014
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
1300513015
integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==
1300613016

13017+
minimatch@^10.0.1:
13018+
version "10.0.1"
13019+
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.1.tgz#ce0521856b453c86e25f2c4c0d03e6ff7ddc440b"
13020+
integrity sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==
13021+
dependencies:
13022+
brace-expansion "^2.0.1"
13023+
1300713024
minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
1300813025
version "3.1.2"
1300913026
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"

0 commit comments

Comments
 (0)