Skip to content

Commit

Permalink
Merge pull request #5660 from artsy/add-eslint
Browse files Browse the repository at this point in the history
Add eslint
  • Loading branch information
damassi authored May 27, 2020
2 parents 6bf557f + 760d5a5 commit 72f79f6
Show file tree
Hide file tree
Showing 234 changed files with 1,455 additions and 1,555 deletions.
20 changes: 0 additions & 20 deletions .eslintrc

This file was deleted.

110 changes: 110 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
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: {
"@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,
"react/display-name": 0,
"react/prop-types": 0,
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"sort-imports": [
"warn",
{
// Unfortunately there's no autofixer for this
ignoreDeclarationSort: true,
},
],

// 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",
// },
// ],
},
}
83 changes: 37 additions & 46 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "force",
"version": "1.0.0",
"private": true,
"license": "MIT",
"engines": {
"node": "12",
"yarn": "1.x.x"
Expand All @@ -20,6 +21,7 @@
"cypress": "./node_modules/.bin/cypress open",
"integrate": "./scripts/quicklink-to-project.sh",
"jest": "JEST_JUNIT_OUTPUT=reports/junit/js-test-results.xml jest --runInBand",
"lint": "eslint --cache --cache-location '.cache/eslint/' --ext ts,tsx --ignore-pattern 'src/v2/__generated__'",
"mocha": "scripts/mocha.sh",
"prepare": "patch-package",
"prettier-project": "yarn run prettier-write 'src/**/*.{ts,tsx,js,jsx}'",
Expand All @@ -41,12 +43,6 @@
"unlink-all": "yalc remove --all && yarn --check-files",
"webpack": "node --max_old_space_size=2048 -r dotenv/config -r @babel/register node_modules/.bin/webpack --config ./webpack"
},
"prettier": {
"bracketSpacing": true,
"semi": false,
"singleQuote": false,
"trailingComma": "es5"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
Expand All @@ -55,13 +51,33 @@
},
"lint-staged": {
"*.@(js|jsx|ts|tsx)": [
"npm run prettier-write --",
"git add"
],
"{package.json,yarn.lock}": [
"node ./scripts/check-for-links.js"
"yarn lint --fix",
"yarn prettier-write"
]
},
"reporterEnabled": "mocha-junit-reporter, spec",
"mochaJunitReporterReporterOptions": {
"mochaFile": "reports/mocha/test-results.xml"
},
"nyc": {
"check-coverage": true,
"report-dir": "./.nyc_output/",
"reporter": [
"lcov",
"text-summary"
],
"extension": [
".coffee",
".js"
],
"lines": 0
},
"prettier": {
"bracketSpacing": true,
"semi": false,
"singleQuote": false,
"trailingComma": "es5"
},
"resolutions": {
"@types/react": "16.9.34",
"babel-core": "7.0.0-bridge.0",
Expand Down Expand Up @@ -112,7 +128,6 @@
"artsy-ezel-components": "artsy/artsy-ezel-components",
"artsy-morgan": "artsy/artsy-morgan",
"artsy-xapp": "artsy/artsy-xapp",
"babel-eslint": "7.2.3",
"babel-loader": "8.0.6",
"babel-plugin-dynamic-import-node": "1.2.0",
"babel-plugin-inline-react-svg": "0.2.0",
Expand Down Expand Up @@ -304,7 +319,10 @@
"@types/underscore.string": "0.0.32",
"@types/webpack": "4.4.24",
"@types/webpack-env": "1.13.6",
"@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-plugin-relay": "7.1.0",
"benv": "3.3.0",
Expand All @@ -316,15 +334,11 @@
"electron": "3.0.16",
"enzyme": "3.10.0",
"enzyme-adapter-react-16": "1.14.0",
"eslint": "5.6.1",
"eslint-config-prettier": "3.1.0",
"eslint-config-standard": "12.0.0",
"eslint-config-standard-react": "7.0.2",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-node": "7.0.1",
"eslint-plugin-promise": "4.0.1",
"eslint-plugin-react": "7.11.1",
"eslint-plugin-standard": "4.0.0",
"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",
"fork-ts-checker-notifier-webpack-plugin": "0.4.0",
"fork-ts-checker-webpack-plugin": "0.4.10",
"friendly-errors-webpack-plugin": "1.6.1",
Expand All @@ -344,7 +358,7 @@
"jsdom-global": "3.0.2",
"json-loader": "0.5.7",
"konami-js": "0.0.2",
"lint-staged": "9.2.5",
"lint-staged": "10.0.8",
"mime": "2.4.0",
"mocha": "3.4.1",
"mocha-junit-reporter": "1.22.0",
Expand Down Expand Up @@ -372,10 +386,6 @@
"stylus-loader": "3.0.2",
"supertest": "2.0.1",
"terser-webpack-plugin": "2.3.5",
"tslint": "5.11.0",
"tslint-config-prettier": "1.15.0",
"tslint-config-standard": "8.0.1",
"tslint-react": "3.6.0",
"typescript-styled-plugin": "0.15.0",
"vscode-apollo-relay": "1.5.0",
"wait-on": "3.3.0",
Expand All @@ -387,28 +397,9 @@
"webpack-manifest-plugin": "2.0.4",
"webpack-merge": "4.2.1",
"webpack-notifier": "1.7.0",
"webpack-retry-chunk-load-plugin": "1.2.0",
"yalc": "1.0.0-pre.34"
"webpack-retry-chunk-load-plugin": "1.2.0"
},
"license": "MIT",
"optionalDependencies": {
"fsevents": "*"
},
"reporterEnabled": "mocha-junit-reporter, spec",
"mochaJunitReporterReporterOptions": {
"mochaFile": "reports/mocha/test-results.xml"
},
"nyc": {
"check-coverage": true,
"report-dir": "./.nyc_output/",
"reporter": [
"lcov",
"text-summary"
],
"extension": [
".coffee",
".js"
],
"lines": 0
}
}
69 changes: 0 additions & 69 deletions scripts/check-for-links.js

This file was deleted.

25 changes: 0 additions & 25 deletions scripts/quicklink-to-project.sh

This file was deleted.

Loading

0 comments on commit 72f79f6

Please sign in to comment.