Skip to content

Commit

Permalink
Update ESLint configuration to use @verypossible/eslint-config (#24)
Browse files Browse the repository at this point in the history
* Update ESLint configuration to use `@verypossible/eslint-config`

Why
- We need to standardize how we handle the ESLint configuration across different projects at Very

How
- Add the `@verypossible/eslint-config` dependency to the project
- Remove unused ESLint dependencies
- Configure the import module resolver
  • Loading branch information
luizbaldi authored Feb 5, 2021
1 parent 75417cf commit a5ecee7
Show file tree
Hide file tree
Showing 5 changed files with 437 additions and 305 deletions.
38 changes: 12 additions & 26 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
module.exports = {
extends: [
'airbnb',
'plugin:prettier/recommended',
'prettier/react',
'plugin:@typescript-eslint/recommended'
],
plugins: ['react', 'prettier', 'import'],
parser: '@typescript-eslint/parser',
extends: ['@verypossible/eslint-config/native'],
plugins: ['import'],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
directory: './tsconfig.json'
}
}
},
env: {
jest: true
project: './tsconfig.json',
},
},
},
rules: {
'react/jsx-filename-extension': [1, { extensions: ['.ts', '.tsx'] }],
'import/extensions': ['error', { ts: 'never', tsx: 'never' }],
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: ['**/*.spec.tsx'] }
],
'import/prefer-default-export': 'off',
'react/prop-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/explicit-function-return-type': 'off'
}
};
'import/no-unresolved': 'error',
'prettier/prettier': ['error', { singleQuote: true }],
},
}
7 changes: 4 additions & 3 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module.exports = {
requirePragma: false,
singleQuote: true,
tabWidth: 2,
trailingComma: 'none',
trailingComma: 'es5',
useTabs: false,
printWidth: 80
};
printWidth: 80,
semi: false,
}
20 changes: 7 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint 'src/**/*.{ts,tsx}'",
"lint": "eslint src --ext .ts,.tsx",
"start": "react-native start",
"test": "jest",
"test:watch": "yarn test -- --watch"
Expand Down Expand Up @@ -34,29 +34,23 @@
"@types/jest": "^26.0.14",
"@types/react": "^16.9.51",
"@types/styled-components": "^5.1.3",
"@typescript-eslint/eslint-plugin": "^4.4.0",
"@typescript-eslint/parser": "^4.4.0",
"@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2",
"@verypossible/eslint-config": "^1.0.2",
"babel-jest": "^26.5.2",
"babel-loader": "^8.1.0",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-styled-components": "^1.11.1",
"eslint": "^7.10.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.12.0",
"eslint-import-resolver-babel-module": "^5.1.2",
"eslint": "^7.19.0",
"eslint-import-resolver-typescript": "^2.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.3",
"eslint-plugin-react-hooks": "^4.1.2",
"jest": "^26.5.2",
"metro-react-native-babel-preset": "^0.57.0",
"prettier": "^2.1.2",
"prettier": "^2.2.1",
"react-dom": "^16.13.1",
"react-native-testing-library": "^6.0.0",
"react-test-renderer": "^16.13.1",
"typescript": "^4.0.3"
"typescript": "^4.1.3"
},
"jest": {
"preset": "react-native",
Expand Down
7 changes: 0 additions & 7 deletions prettier.config.js

This file was deleted.

Loading

0 comments on commit a5ecee7

Please sign in to comment.