Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lint): adds stricter eslint configs #2283

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 59 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
module.exports = {
root: true,
ignorePatterns: [".eslintrc.js"],
env: {
node: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
// extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parserOptions: {
project: ["tsconfig.eslint.json"],
},
plugins: ["prettier", "jest", "@typescript-eslint"],
extends: ["airbnb", "prettier", "plugin:@typescript-eslint/recommended"],
rules: {
'member-access': 0,
'interface-name': 0,
Expand All @@ -17,5 +20,58 @@ module.exports = {
'no-console': 0,
'no-shadowed-variable': 0,
'no-extra-boolean-cast': 0,
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"import/extensions": [ "error", "ignorePackages", { js: "never", jsx: "never", ts: "never", tsx: "never" }, ],
"no-underscore-dangle": "off",
"react/jsx-filename-extension": [1, { extensions: [".jsx", ".tsx"] }],

"@typescript-eslint/ban-ts-comment": 0, // FIXME: should be considered
"@typescript-eslint/no-inferrable-types": 0, // FIXME: should be considered
"@typescript-eslint/no-non-null-asserted-optional-chain": 0, // FIXME: should be considered
"@typescript-eslint/no-non-null-assertion": 0, // FIXME: should be considered
"@typescript-eslint/no-unused-vars": 0, // FIXME: should be considered
"arrow-body-style": 0, // FIXME: should be considered
"class-methods-use-this": 0, // FIXME: should be considered
"default-param-last": 0, // FIXME: should be considered
"eqeqeq": 0, // FIXME: should be considered
"import/no-cycle": 0, // FIXME: should be considered
"import/order": 0, // FIXME: should be considered
"import/prefer-default-export": 0, // FIXME: should be considered
"lines-between-class-members": 0, // FIXME: should be considered
"no-else-return": 0, // FIXME: should be considered
"no-lonely-if": 0, // FIXME: should be considered
"no-param-reassign": 0, //FIME
"no-return-assign": 0, // FIXME: should be considered
"no-shadow": 0,
"no-use-before-define": 0, // FIXME: should be considered
"no-useless-return": 0, // FIXME: should be considered
"prefer-destructuring": 0, // FIXME: should be considered
"react/destructuring-assignment": 0, // FIXME: should be considered
"react/forbid-prop-types": 0, // FIXME: should be considered
"react/function-component-definition": 0,// FIXME: should be considered
"react/jsx-curly-brace-presence": 0, // FIXME: should be considered
"react/jsx-no-constructed-context-values": 0, // FIXME: should be considered
"react/jsx-no-constructed-context-values": 0, // FIXME: should be considered
"react/jsx-props-no-spreading": 0, // FIXME: should be considered
"react/no-array-index-key": 0, // FIXME: should be considered
"react/no-unused-class-component-methods": 0, // FIXME: should be considered
"react/no-unused-prop-types": 0, // FIXME: should be considered
"react/require-default-props": 0, // FIXME: should be considered
"react/sort-comp": 0, // FIXME: should be considered
"react/state-in-constructor": 0, // FIXME: should be considered
"react/static-property-placement": 0, // FIXME: should be considered
"spaced-comment": 0, // FIXME: should be considered
},
settings: {
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
"import/parsers": {
"@typescript-eslint/parser": [".test.ts", ".test.tsx", ".ts", ".tsx"],
},
"import/resolver": {
node: {
extensions: [".ts", ".tsx", ".js", ".jsx"],
},
},
},
}
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"homepage": "https://github.com/FaridSafi/react-native-gifted-chat#readme",
"scripts": {
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint": "eslint ./src/ --ext .js,.jsx,.ts,.tsx",
"lint:fix": "./node_modules/.bin/eslint ./src/*.{ts,tsx} --fix",
"tsc": "node_modules/.bin/tsc --noEmit",
"tsc:watch": "node_modules/.bin/tsc --watch --noEmit",
Expand All @@ -52,7 +52,14 @@
"@typescript-eslint/parser": "5.18.0",
"babel-jest": "27.5.1",
"eslint": "8.13.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.1.2",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.3.0",
"flow-bin": "0.125.0",
"husky": "4.2.5",
"jest": "27.5.1",
Expand Down
4 changes: 4 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "example"]
}
Loading