Skip to content

Commit d91e615

Browse files
committed
feat: 🎸 add eslint following ecosystem)02 process
1 parent 6b2b27b commit d91e615

File tree

18 files changed

+5126
-1839
lines changed

18 files changed

+5126
-1839
lines changed

challenges/ecosystem/02.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,14 @@ module.exports = {
148148
"plugin:react/jsx-runtime", // support for React 17 JSX
149149
"plugin:prettier/recommended" // Prettier recommended rules
150150
],
151-
plugins: ["react", "simple-import-sort"], // add React and React Native plugins
151+
plugins: ["react"], // add React and React Native plugins
152152
rules: {
153153
"prettier/prettier": [ // Prettier rules
154154
"warn",
155155
{
156156
usePrettierrc: true
157157
}
158158
],
159-
"react-native/no-color-literals": 2, // enforce color literals are not used
160-
"react-native/no-unused-styles": 2, // detect unused StyleSheet rules
161-
"react-native/no-raw-text": 0, // detect raw text outside of Text component
162-
"react-native/sort-styles": 2, // enforce style definitions are sorted
163159
"@typescript-eslint/no-unused-vars": "warn", // detect unused variables
164160
}
165161
};
@@ -200,6 +196,7 @@ yarn add -D eslint-plugin-react-native
200196
// .eslintrc.js
201197

202198
{
199+
plugins: ["react", "react-native"],
203200
"rules": {
204201
...
205202
"react-native/no-color-literals": 2, // enforce color literals are not used
@@ -228,6 +225,7 @@ yarn add -D eslint-plugin-simple-import-sort
228225

229226
{
230227
"rules": {
228+
plugins: ["react", "react-native", "eslint-plugin-simple-import-sort"],
231229
...
232230
"simple-import-sort/exports": "warn", // enforce sorting exports within module
233231
"simple-import-sort/imports": [

hackathon/svg-icons/.eslintrc.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
module.exports = {
2+
env: {
3+
node: true,
4+
},
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
7+
extends: [
8+
"eslint:recommended", // ESLint rules
9+
"plugin:@typescript-eslint/recommended", // TypeScript rules
10+
"plugin:react/recommended", // React rules
11+
"plugin:react/jsx-runtime", // support for React 17 JSX
12+
"plugin:prettier/recommended", // Prettier recommended rules
13+
],
14+
plugins: ["react", "react-native", "eslint-plugin-simple-import-sort"], // add React and React Native plugins
15+
rules: {
16+
camelcase: "off", // disable camelcase rule
17+
"@typescript-eslint/no-explicit-any": "warn", // detect usage of `any` type
18+
"simple-import-sort/exports": "warn", // enforce sorting exports within module
19+
"simple-import-sort/imports": [
20+
"warn",
21+
{
22+
groups: [
23+
// Side effect imports.
24+
["^\\u0000"],
25+
// Packages `react` related packages come first.
26+
["^react", "^@?\\w"],
27+
// Environment variables
28+
["^(@env)(/.*|$)"],
29+
// Parent imports. Put `..` last.
30+
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
31+
// Other relative imports. Put same-folder imports and `.` last.
32+
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
33+
],
34+
},
35+
],
36+
"react-native/no-color-literals": 2, // enforce color literals are not used
37+
"react-native/no-unused-styles": 2, // detect unused StyleSheet rules
38+
"react-native/no-raw-text": 0, // detect raw text outside of Text component
39+
"react-native/sort-styles": 2, // enforce style definitions are sorted
40+
"prettier/prettier": [
41+
// Prettier rules
42+
"warn",
43+
{
44+
usePrettierrc: true,
45+
},
46+
],
47+
"@typescript-eslint/no-unused-vars": "warn", // detect unused variables
48+
},
49+
};

hackathon/svg-icons/.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "http://json.schemastore.org/prettierrc",
3+
"semi": true,
4+
"singleAttributePerLine": true,
5+
"trailingComma": "all",
6+
"tabWidth": 2,
7+
"singleQuote": false
8+
}

hackathon/svg-icons/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
2-
import { StyleSheet, ScrollView } from "react-native";
2+
import { ScrollView, StyleSheet } from "react-native";
3+
34
import {
45
AlienGun,
56
ArRobot,

hackathon/svg-icons/babel.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
module.exports = function(api) {
1+
module.exports = function (api) {
22
api.cache(true);
33
return {
4-
presets: ['babel-preset-expo'],
4+
presets: ["babel-preset-expo"],
55
};
66
};

hackathon/svg-icons/package.json

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,33 @@
88
"android": "expo start --android",
99
"ios": "expo start --ios",
1010
"web": "expo start --web",
11-
"eject": "expo eject"
11+
"eject": "expo eject",
12+
"lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx ."
1213
},
1314
"dependencies": {
14-
"expo": "~44.0.0",
15-
"expo-status-bar": "~1.2.0",
16-
"react": "17.0.1",
17-
"react-dom": "17.0.1",
18-
"react-native": "0.64.3",
19-
"react-native-svg": "^12.3.0",
20-
"react-native-web": "0.17.1"
15+
"expo": "^51.0.0",
16+
"expo-status-bar": "~1.12.1",
17+
"react": "18.2.0",
18+
"react-dom": "18.2.0",
19+
"react-native": "0.74.1",
20+
"react-native-svg": "15.2.0",
21+
"react-native-web": "~0.19.10"
2122
},
2223
"devDependencies": {
23-
"@babel/core": "^7.12.9",
24+
"@babel/core": "^7.24.0",
2425
"@svgr/cli": "^6.2.1",
2526
"@svgr/webpack": "^6.2.1",
26-
"@types/react": "~17.0.21",
27+
"@types/react": "~18.2.79",
2728
"@types/react-native": "~0.64.12",
28-
"typescript": "~4.3.5"
29+
"eslint": "^8.57.0",
30+
"eslint-config-expo": "^7.0.0",
31+
"eslint-config-prettier": "^9.1.0",
32+
"eslint-plugin-prettier": "^5.1.3",
33+
"eslint-plugin-react": "^7.34.2",
34+
"eslint-plugin-react-native": "^4.1.0",
35+
"eslint-plugin-simple-import-sort": "^12.1.0",
36+
"prettier": "^3.2.5",
37+
"typescript": "~5.3.3"
2938
},
3039
"private": true
3140
}

hackathon/svg-icons/src/components/icons/AlienGun.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Run yarn icons:create to update
33
// Do not edit
44
import * as React from "react";
5-
import Svg, { SvgProps, Path } from "react-native-svg";
5+
import Svg, { Path, SvgProps } from "react-native-svg";
66

77
const SvgAlienGun = (props: SvgProps) => (
88
<Svg

hackathon/svg-icons/src/components/icons/ArRobot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Run yarn icons:create to update
33
// Do not edit
44
import * as React from "react";
5-
import Svg, { SvgProps, Path } from "react-native-svg";
5+
import Svg, { Path, SvgProps } from "react-native-svg";
66

77
const SvgArRobot = (props: SvgProps) => (
88
<Svg

hackathon/svg-icons/src/components/icons/Astronaut.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Run yarn icons:create to update
33
// Do not edit
44
import * as React from "react";
5-
import Svg, { SvgProps, Path } from "react-native-svg";
5+
import Svg, { Path, SvgProps } from "react-native-svg";
66

77
const SvgAstronaut = (props: SvgProps) => (
88
<Svg

hackathon/svg-icons/src/components/icons/Cloning.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Run yarn icons:create to update
33
// Do not edit
44
import * as React from "react";
5-
import Svg, { SvgProps, Path } from "react-native-svg";
5+
import Svg, { Path, SvgProps } from "react-native-svg";
66

77
const SvgCloning = (props: SvgProps) => (
88
<Svg

hackathon/svg-icons/src/components/icons/FetalCloning.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Run yarn icons:create to update
33
// Do not edit
44
import * as React from "react";
5-
import Svg, { SvgProps, Path } from "react-native-svg";
5+
import Svg, { Path, SvgProps } from "react-native-svg";
66

77
const SvgFetalCloning = (props: SvgProps) => (
88
<Svg

hackathon/svg-icons/src/components/icons/FlyingCar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Run yarn icons:create to update
33
// Do not edit
44
import * as React from "react";
5-
import Svg, { SvgProps, Path } from "react-native-svg";
5+
import Svg, { Path, SvgProps } from "react-native-svg";
66

77
const SvgFlyingCar = (props: SvgProps) => (
88
<Svg

hackathon/svg-icons/src/components/icons/HolographicCityModel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Run yarn icons:create to update
33
// Do not edit
44
import * as React from "react";
5-
import Svg, { SvgProps, Path } from "react-native-svg";
5+
import Svg, { Path, SvgProps } from "react-native-svg";
66

77
const SvgHolographicCityModel = (props: SvgProps) => (
88
<Svg

hackathon/svg-icons/src/components/icons/RoboticHand.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Run yarn icons:create to update
33
// Do not edit
44
import * as React from "react";
5-
import Svg, { SvgProps, Path } from "react-native-svg";
5+
import Svg, { Path, SvgProps } from "react-native-svg";
66

77
const SvgRoboticHand = (props: SvgProps) => (
88
<Svg

hackathon/svg-icons/src/components/icons/SmartCar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Run yarn icons:create to update
33
// Do not edit
44
import * as React from "react";
5-
import Svg, { SvgProps, Path } from "react-native-svg";
5+
import Svg, { Path, SvgProps } from "react-native-svg";
66

77
const SvgSmartCar = (props: SvgProps) => (
88
<Svg

hackathon/svg-icons/src/components/icons/TopRight.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from "react";
2-
import Svg, { SvgProps, Path } from "react-native-svg";
2+
import Svg, { Path, SvgProps } from "react-native-svg";
33

44
const SvgTopRight = (props: SvgProps) => (
55
<Svg

hackathon/svg-icons/src/components/icons/VrProgram.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Run yarn icons:create to update
33
// Do not edit
44
import * as React from "react";
5-
import Svg, { SvgProps, Path } from "react-native-svg";
5+
import Svg, { Path, SvgProps } from "react-native-svg";
66

77
const SvgVrProgram = (props: SvgProps) => (
88
<Svg

0 commit comments

Comments
 (0)