Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

Commit e51a7a2

Browse files
committed
🔧 (eslint) use typescript-eslint
1 parent a447646 commit e51a7a2

8 files changed

Lines changed: 167 additions & 254 deletions

File tree

.eslintrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintrc.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
3+
extends: [
4+
'eslint:recommended',
5+
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
6+
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin
7+
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
8+
],
9+
parserOptions: {
10+
ecmaVersion: 2018,
11+
sourceType: 'module',
12+
ecmaFeatures: {
13+
jsx: true,
14+
},
15+
},
16+
rules: {
17+
'@typescript-eslint/indent': 'off',
18+
'@typescript-eslint/explicit-function-return-type': 'off',
19+
'@typescript-eslint/explicit-member-accessibility': 'off',
20+
},
21+
settings: {
22+
react: {
23+
version: 'detect',
24+
},
25+
},
26+
env: {
27+
browser: true,
28+
node: true,
29+
},
30+
overrides: [
31+
{
32+
files: ['**/*.test.ts', '**/*.test.tsx'],
33+
env: {
34+
jest: true,
35+
},
36+
rules: {
37+
'@typescript-eslint/explicit-function-return-type': 'off',
38+
},
39+
},
40+
],
41+
};

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
package.json

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"trailingComma": "es5",
3+
"singleQuote": true,
4+
"printWidth": 100
5+
}

.vscode/settings.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
2-
"prettier.eslintIntegration": true,
3-
"javascript.validate.enable": false,
42
"editor.formatOnSave": true,
3+
"eslint.enable": true,
4+
"eslint.packageManager": "yarn",
5+
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
6+
"javascript.validate.enable": false,
57
"jest.showCoverageOnLoad": true,
6-
"typescript.validate.enable": true,
78
"npm.packageManager": "yarn",
8-
"eslint.packageManager": "yarn",
9-
"prettier.tslintIntegration": true
9+
"prettier.requireConfig": true,
10+
"typescript.validate.enable": true
1011
}

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"postinstall": "patch-package",
77
"start": "node ../node_modules/react-native/local-cli/cli.js start",
8-
"test:lint": "cd .. && yarn tslint example/src/**/*.ts{,x} && cd example",
8+
"test:lint": "cd .. && yarn eslint example/src/**/*.ts{,x} && cd example",
99
"test:unit": "cd .. && yarn jest --config=example/jest.config.js && cd example",
1010
"test:unit:u": "cd .. && yarn jest --config=example/jest.config.js -u && cd example",
1111
"test:unit:ci": "cd .. && yarn jest --config=example/jest.config.js --runInBand && cd example",

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"doc:dev": "docz dev",
3030
"release": "release-it",
3131
"test:ci": "yarn test:lint && yarn test:unit:ci && yarn test:type",
32-
"test:lint": "tslint src/**/*.ts{,x}",
32+
"test:lint": "eslint src/**/*.ts{,x}",
3333
"test:type": "tsc --noEmit",
3434
"test:unit:ci": "jest --runInBand",
3535
"test:unit": "jest",
@@ -43,14 +43,18 @@
4343
"@types/jest": "^24.0.11",
4444
"@types/react-native": "^0.60.0",
4545
"@types/react-test-renderer": "^16.8.1",
46+
"@typescript-eslint/eslint-plugin": "^1.12.0",
47+
"@typescript-eslint/parser": "^1.12.0",
4648
"babel-jest": "^24.7.0",
4749
"conventional-changelog-cz-emoji": "^2.0.0",
4850
"coveralls": "^3.0.4",
4951
"cz-emoji": "^1.1.2",
5052
"docz": "^1.2.0",
5153
"docz-theme-default": "^1.2.0",
5254
"eslint": "^6.0.1",
53-
"eslint-config-bambi": "^1.4.0",
55+
"eslint-config-prettier": "^6.0.0",
56+
"eslint-plugin-prettier": "^3.1.0",
57+
"eslint-plugin-react": "^7.14.2",
5458
"jest": "^24.7.0",
5559
"metro-react-native-babel-preset": "^0.55.0",
5660
"mobx": "^5.9.4",

0 commit comments

Comments
 (0)