Skip to content

Instantly share code, notes, and snippets.

@Geospace Geospace/.eslintrc
Created May 11, 2019

Embed
What would you like to do?
ESLint configuration, for TypeScript
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
// Version bumps are sometimes a bit slow so we can
// but this at false to avoid a warning at lint/build
"warnOnUnsupportedTypeScriptVersion": true
},
"settings": {
"import/resolver": {
"node": {
// All the file extensions we can lint on
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
},
"env": {
"browser": true
},
"extends": [
// We have TypeScript
"plugin:@typescript-eslint/recommended",
// Our starting point is the AirBnb configuration
"airbnb"
],
"plugins": [
"react"
],
"rules": {
// Single quotes
"quotes": [
"error",
"single"
],
// Allow .jsx and .tsx
"react/jsx-filename-extension": [
"error", {
"extensions": [
".jsx",
".tsx"
]
}
],
// Three rules for the curly braces and the new lines
"curly": ["error", "multi"],
"object-curly-newline": ["off"],
"nonblock-statement-body-position": ["error", "below"],
// Indent JS at 2
"indent": ["error", 2],
// Destructuring whenever possible
"prefer-destructuring": ["warn"],
// We don't want the extra parentheses around arrow functions
"arrow-parens": "off",
// We don't want to skip lines between class members
"lines-between-class-members": ["off"],
// Indent TS at 2
"@typescript-eslint/indent": ["error", 2],
// We don't care about member accessibility, the defaults are good
"@typescript-eslint/explicit-member-accessibility": ["off"],
// Explicit return types are mandatory in the declarations,
// not in the expressions
"@typescript-eslint/explicit-function-return-type": [
"error", {
"allowExpressions": ["true"]
}
],
// Allow things like <App><Hello /></App>
"react/jsx-one-expression-per-line": ["off"],
// Let us do what we want with destructuring
// This is a rule we might add in the future in order to
// be more uniform with how we use the props
"react/destructuring-assignment": ["off"],
// Allow export without export default
"import/prefer-default-export": ["off"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.