Skip to content

Instantly share code, notes, and snippets.

@mckenziearts
Forked from 1natsu172/.eslintrc
Created November 23, 2019 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mckenziearts/8e175f46ab29f031aef48934780a6d88 to your computer and use it in GitHub Desktop.
Save mckenziearts/8e175f46ab29f031aef48934780a6d88 to your computer and use it in GitHub Desktop.
My airbnb based ESLint config for "typescript-eslint" with React & prettier
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"tsconfigRootDir": "."
},
"env": {
"browser": true,
"jest/globals": true
},
"plugins": ["@typescript-eslint", "react-hooks", "jest", "prettier"],
"extends": [
"airbnb",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
],
"rules": {
/**
* @description rules of eslint official
*/
/**
* @bug https://github.com/benmosher/eslint-plugin-import/issues/1282
* "import/named" temporary disable.
*/
"import/named": "off",
/**
* @bug?
* "import/export" temporary disable.
*/
"import/export": "off",
"import/prefer-default-export": "off", // Allow single Named-export
"no-unused-expressions": ["warn", {
"allowShortCircuit": true,
"allowTernary": true
}], // https://eslint.org/docs/rules/no-unused-expressions
/**
* @description rules of @typescript-eslint
*/
"@typescript-eslint/prefer-interface": "off", // also want to use "type"
"@typescript-eslint/explicit-function-return-type": "off", // annoying to force return type
/**
* @description rules of eslint-plugin-react
*/
"react/jsx-filename-extension": ["warn", {
"extensions": [".jsx", ".tsx"]
}], // also want to use with ".tsx"
"react/prop-types": "off", // Is this incompatible with TS props type?
/**
* @description rules of eslint-plugin-react-hooks
*/
"react-hooks/rules-of-hooks": "error",
/**
* @description rules of eslint-plugin-prettier
*/
"prettier/prettier": [
"error", {
"singleQuote": true,
"semi": false
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment