Skip to content

Commit e61a647

Browse files
committed
new: eslintrc and tsconfig are updated
1 parent a6427eb commit e61a647

File tree

3 files changed

+101
-37
lines changed

3 files changed

+101
-37
lines changed

.eslintrc.js

Lines changed: 67 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,77 @@
11
module.exports = {
22
root: true,
3-
extends: [
4-
"@react-native-community",
5-
"airbnb-typescript",
6-
"prettier",
7-
"prettier/@typescript-eslint",
8-
"prettier/react"
9-
],
10-
parser: "babel-eslint",
11-
plugins: ["react", "react-native"],
12-
env: {
13-
jest: true,
14-
"react-native/react-native": true
3+
extends: "@react-native-community",
4+
parser: "@typescript-eslint/parser",
5+
plugins: ["import", "eslint-plugin-import", "@typescript-eslint"],
6+
settings: {
7+
"import/resolver": {
8+
node: {
9+
extensions: [
10+
".js",
11+
".jsx",
12+
".ts",
13+
".tsx",
14+
".d.ts",
15+
".android.js",
16+
".android.jsx",
17+
".android.ts",
18+
".android.tsx",
19+
".ios.js",
20+
".ios.jsx",
21+
".ios.ts",
22+
".ios.tsx",
23+
".web.js",
24+
".web.jsx",
25+
".web.ts",
26+
".web.tsx",
27+
],
28+
},
29+
},
1530
},
1631
rules: {
17-
// allow js file extension
18-
"react/jsx-filename-extension": [
32+
quotes: [
1933
"error",
34+
"double",
2035
{
21-
extensions: [".js", ".jsx", ".tsx", ".ts"]
22-
}
36+
avoidEscape: true,
37+
},
2338
],
24-
// for post defining style object in react-native
25-
"no-use-before-define": ["error", { variables: false }],
26-
// react-native rules
39+
"max-len": ["error", 120],
40+
"@typescript-eslint/ban-ts-comment": 2,
41+
"@typescript-eslint/no-explicit-any": 2,
42+
"@typescript-eslint/explicit-module-boundary-types": 0,
43+
"react/jsx-filename-extension": ["error", { extensions: [".tsx"] }],
2744
"react-native/no-unused-styles": 2,
2845
"react-native/split-platform-components": 2,
29-
"react-native/no-inline-styles": 2,
30-
"react-native/no-raw-text": 2
31-
}
46+
"react-native/no-inline-styles": 0,
47+
"react-native/no-color-literals": 0,
48+
"react-native/no-raw-text": 0,
49+
"import/no-extraneous-dependencies": 2,
50+
"import/extensions": ["error", "never", { svg: "always" }],
51+
"import/no-named-as-default-member": 2,
52+
"import/order": ["error", { "newlines-between": "always" }],
53+
"import/no-duplicates": 2,
54+
"import/no-useless-path-segments": 2,
55+
"import/no-cycle": 2,
56+
"import/prefer-default-export": 0,
57+
"import/no-anonymous-default-export": 0,
58+
"import/named": 0,
59+
"@typescript-eslint/no-empty-interface": 0,
60+
"import/namespace": 0,
61+
"import/default": 0,
62+
"import/no-named-as-default": 0,
63+
"import/no-unused-modules": 0,
64+
"import/no-deprecated": 0,
65+
"@typescript-eslint/indent": 0,
66+
"react-hooks/rules-of-hooks": 2,
67+
"react-hooks/exhaustive-deps": [
68+
"error",
69+
{ additionalHooks: "(useMemoOne)" },
70+
],
71+
"jest/no-identical-title": 2,
72+
"jest/valid-expect": 2,
73+
camelcase: 2,
74+
"prefer-destructuring": 2,
75+
"no-nested-ternary": 2,
76+
},
3277
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-typescript-library-starter",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "Extremely easy to create a React Native Component Library with both Stateful and Functional Component Examples.",
55
"main": "./build/dist/index.js",
66
"repository": "[email protected]:WrathChaos/react-native-typescript-library-starter.git",

tsconfig.json

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,47 @@
11
{
22
"compilerOptions": {
33
"target": "esnext",
4-
"module": "commonjs",
5-
"lib": ["es6"],
4+
"module": "esnext",
5+
"lib": ["esnext"],
66
"allowJs": true,
77
"jsx": "react-native",
8-
"noImplicitAny": false,
9-
"incremental": true /* Enable incremental compilation */,
10-
"isolatedModules": true,
8+
"noEmit": true,
9+
"isolatedModules": false,
1110
"strict": true,
1211
"moduleResolution": "node",
13-
"skipLibCheck": true,
14-
"baseUrl": "./",
15-
"outDir": "build/dist",
16-
"noEmitHelpers": true,
17-
"importHelpers": true,
18-
"experimentalDecorators": true,
1912
"allowSyntheticDefaultImports": true,
2013
"esModuleInterop": true,
21-
"declaration": true /* Generates corresponding '.d.ts' file. */,
22-
"sourceMap": true /* Generates corresponding '.map' file. */
14+
// ? Custom ones
15+
"skipLibCheck": true,
16+
"resolveJsonModule": true,
17+
"noImplicitAny": true,
18+
"strictNullChecks": true,
19+
"strictFunctionTypes": true,
20+
"strictPropertyInitialization": true,
21+
"noImplicitThis": true,
22+
"alwaysStrict": true,
23+
"noUnusedLocals": true,
24+
"noUnusedParameters": true,
25+
"noImplicitReturns": true,
26+
"noFallthroughCasesInSwitch": true,
27+
"forceConsistentCasingInFileNames": true,
28+
// ? Babel Plugin Module Resolver
29+
"baseUrl": "./src",
30+
"paths": {
31+
"@shared-components/*": ["./shared/components/*"],
32+
"@shared-constants": ["./shared/constants"],
33+
"@font-size": ["./shared/theme/font-size"],
34+
"@api": ["./services/api/index"],
35+
"@fonts": ["./shared/theme/fonts/index"],
36+
"@colors": ["./shared/theme/colors"],
37+
"@theme": ["./shared/theme/*"],
38+
"@services/*": ["./services/*"],
39+
"@screens/*": ["./screens/*"],
40+
"@utils": ["./utils/"],
41+
"@assets": ["./assets/"]
42+
}
2343
},
2444
"exclude": [
25-
"example",
2645
"node_modules",
2746
"babel.config.js",
2847
"metro.config.js",

0 commit comments

Comments
 (0)