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

[Toolchain] Replace TSLint with ESLint #3467

Merged
merged 2 commits into from
Apr 29, 2020
Merged
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
104 changes: 104 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
const path = require("path")

module.exports = {
parser: "@typescript-eslint/parser",

plugins: [
"react-hooks",
"@typescript-eslint",
// TODO: Add support for Graphql
/*, "graphql" */
],
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 6,
project: "./tsconfig.json",
sourceType: "module",
},
settings: {
react: {
version: "detect",
},
},
env: {
es6: true,
browser: true,
jest: true,
node: true,
},
rules: {
"react/display-name": 0,
"react/prop-types": 0,
"@typescript-eslint/ban-ts-ignore": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/explicit-member-accessibility": 0,
"@typescript-eslint/indent": 0,
"@typescript-eslint/member-delimiter-style": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/no-unused-vars": 0,
"@typescript-eslint/no-var-requires": 0,

// FIXME: Fix issues with React Hooks:
"react-hooks/rules-of-hooks": 0,
"react-hooks/exhaustive-deps": 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏


// FIXME: Investigate / reenable these rules. Disabled to introduce eslint
// into codebase.
"no-async-promise-executor": 0,
"no-case-declarations": 0,
"no-console": 0,
"no-constant-condition": 0,
"no-empty-pattern": 0,
"no-extra-boolean-cast": 0,
"no-inner-declarations": 0,
"no-irregular-whitespace": 0,
"no-prototype-builtins": 0,
"no-undef": 0,
"no-unreachable": 0,
"no-useless-escape": 0,
"prefer-const": 0,
"prefer-rest-params": 0,
"react/jsx-key": 0,
"react/jsx-no-target-blank": 0,
"react/no-direct-mutation-state": 0,
"react/no-find-dom-node": 0,
"react/no-unescaped-entities": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-non-null-assertion": 0,
// "@typescript-eslint/no-unused-vars": [
// "error",
// {
// argsIgnorePattern: "^_",
// },
// ],
// "no-console": [
// "error",
// {
// allow: ["warn", "error"],
// },
// ],

// TODO: Add support for Graphql, but first need to fetch .json schema
// "graphql/template-strings": [
// "error",
// {
// env: "relay",
// schemaJsonFilepath: path.resolve(__dirname, "./data/schema.json"),
// tagName: "graphql",
// },
// ],
},
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.cache
.cache-loader
.env
.eslintcache
.storybook/.DS_Store
.storybook/manager.js
.tsbuildinfo
Expand Down
24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"emit-types": "tsc --declaration --emitDeclarationOnly --listEmittedFiles --jsx react --outDir dist",
"find-unused-fields": "ts-node scripts/find-unused-fields",
"integrate": "./scripts/quicklink-to-project.sh",
"lint": "tslint -c tslint.json --project tsconfig.json && yarn prettier-check",
"lint": "eslint src --cache --ext ts,tsx --ignore-pattern 'src/__generated__'",
"omg": "om g",
"prepare": "patch-package",
"prepublishOnly": "yarn clean && yarn relay && yarn compile && yarn emit-types",
Expand Down Expand Up @@ -104,7 +104,10 @@
"@types/styled-components": "4.0.3",
"@types/styled-system": "3.0.9",
"@types/underscore.string": "0.0.32",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-jest": "24.8.0",
"babel-loader": "8.0.5",
"babel-plugin-lodash": "3.3.3",
Expand All @@ -121,6 +124,11 @@
"dotenv": "4.0.0",
"enzyme": "3.8.0",
"enzyme-adapter-react-16": "1.7.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-graphql": "^3.1.1",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^3.0.0",
"flickity": "2.1.2",
"fork-ts-checker-notifier-webpack-plugin": "0.6.2",
"fork-ts-checker-webpack-plugin": "0.4.10",
Expand Down Expand Up @@ -158,10 +166,6 @@
"stylelint-processor-styled-components": "1.5.1",
"ts-loader": "^3.5.yarn 0",
"ts-node": "8.2.0",
"tslint": "5.11.0",
"tslint-config-prettier": "1.13.0",
"tslint-plugin-relay": "0.0.3",
"tslint-react": "2.6.0",
"typescript": "3.8.3",
"typescript-styled-plugin": "0.13.0",
"vscode-apollo-relay": "1.5.0",
Expand Down Expand Up @@ -287,21 +291,21 @@
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "yarn run type-check"
"pre-push": "yarn type-check"
}
},
"lint-staged": {
"*.@(ts|tsx)": [
"tslint -c tslint.json --fix",
"yarn prettier-write --"
"yarn lint --fix",
"yarn prettier-write"
],
"*.json": [
"yarn prettier-write --"
"yarn prettier-write"
]
},
"lint-changed": {
"*.@(ts|tsx)": [
"tslint -c tslint.json",
"yarn lint",
"yarn prettier -c"
],
"*.json": [
Expand Down
Loading