-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonathon Meng
committed
Jul 13, 2020
0 parents
commit 731f0a8
Showing
3 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# eslint-config | ||
|
||
A config for eslint for the Domo Apps Generator (https://git.empdev.domo.com/CustomApps/generator-da) | ||
|
||
Loosely based on Airbnb's JS and React style guides (https://github.com/airbnb/javascript) with some Typescript-specific rules added. | ||
|
||
In the index.js file, the rules are specified in the rules property. The rules have been migrated from the old tslint-config repo (https://git.empdev.domo.com/CustomApps/tslint-config) | ||
|
||
Depending on what kind of rule you are adding, make sure it is added in the proper order according to the website. The Airbnb style guide is organized into sections, and the React rules are organized into numbers. Add a comment indicating what section or number the rule is coming from. | ||
|
||
### Working with Prettier | ||
All of the rules in eslint-config are almost all focused with the actual semantics of your program and not whitespace, formatting, etc. Prettier is what we use to manage whitespace and formatting. Rules tied to whitespace and formatting should be configured in prettier, not in eslint-config. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "@appteam6/eslint-config", | ||
"version": "1.1.0", | ||
"main": "src/index.js", | ||
"sideEffects": false, | ||
"repository": "[email protected]:CustomApps/monorepo.git", | ||
"scripts": { | ||
"build": "echo 'no build for eslint-config'", | ||
"prepare": "yarn run build", | ||
"test": "echo 'no tests for eslint-config'", | ||
"test:watch": "yarn run test" | ||
}, | ||
"peerDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^2.6.1", | ||
"@typescript-eslint/parser": "^2.6.1", | ||
"eslint": "^6.1.0", | ||
"eslint-config-prettier": "^6.5.0", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"eslint-plugin-react": "^7.16.0", | ||
"prettier": "^1.19.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
plugins: ['prettier', '@typescript-eslint', 'react'], | ||
parser: '@typescript-eslint/parser', // Specifies the ESLint typescript parser | ||
extends: [ | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features | ||
sourceType: 'module', // Allows for the use of imports | ||
ecmaFeatures: { | ||
jsx: true, // Allows for the parsing of TSX | ||
}, | ||
project: './tsconfig.json', | ||
}, | ||
rules: { | ||
// prettier | ||
'prettier/prettier': 'error', | ||
// non-formatting related AirBnB rules | ||
'prefer-const': 'error', | ||
'no-var': 'error', | ||
'object-shorthand': 'error', | ||
'prefer-template': 'error', | ||
'no-eval': 'error', | ||
'no-new-func': 'error', | ||
'no-param-reassign': 'error', | ||
'prefer-arrow-callback': 'error', | ||
'no-duplicate-imports': 'error', | ||
'one-var': ['error', 'never'], | ||
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], | ||
'eqeqeq': 'error', | ||
'@typescript-eslint/strict-boolean-expressions': 'error', | ||
'brace-style': ['error', '1tbs', { "allowSingleLine": true }], | ||
'no-else-return': 'error', | ||
'spaced-comment': 'error', | ||
'no-new-wrappers': 'error', | ||
'radix': 'error', | ||
'no-shadow-restricted-names': 'error', | ||
'@typescript-eslint/no-this-alias': 'error', | ||
|
||
// react rules | ||
'react/jsx-boolean-value': 'error', | ||
'react/jsx-key': 'error', | ||
'react/no-string-refs': 'error', | ||
'react/self-closing-comp': 'error', | ||
'react/jsx-wrap-multilines': 'error', | ||
|
||
// team rules | ||
'prefer-object-spread': 'error', | ||
'func-style': ['error', 'declaration', { allowArrowFunctions: true }], | ||
'quote-props': ['error', 'as-needed'], | ||
'no-fallthrough': 'error', | ||
'@typescript-eslint/member-ordering': 'error', | ||
'max-classes-per-file': ['error', 1], | ||
'@typescript-eslint/adjacent-overload-signatures': 'error', | ||
'@typescript-eslint/ban-types': [ | ||
'error', | ||
{ | ||
types: { | ||
Object: 'Use {} instead', | ||
Array: 'Use [] instead', | ||
String: 'Use string instead', | ||
Number: 'Use number instead', | ||
} | ||
} | ||
], | ||
'@typescript-eslint/no-empty-interface': 'error', | ||
'@typescript-eslint/no-namespace': [ | ||
'error', | ||
{ allowDeclarations: true }, | ||
], | ||
'@typescript-eslint/no-non-null-assertion': 'error', | ||
'@typescript-eslint/no-require-imports': 'error', | ||
'@typescript-eslint/prefer-for-of': 'error', | ||
'@typescript-eslint/unified-signatures': 'error', | ||
'guard-for-in': 'error', | ||
'@typescript-eslint/ban-types': 'error', | ||
'@typescript-eslint/camelcase': 'error', | ||
'@typescript-eslint/class-name-casing': 'error', | ||
'@typescript-eslint/no-for-in-array': 'error', | ||
'no-restricted-imports': ['error', 'rxjs', 'lodash'], | ||
'no-caller': 'error', | ||
'no-bitwise': 'error', | ||
'no-cond-assign': 'error', | ||
'no-console': 'warn', | ||
'no-debugger': 'warn', | ||
'constructor-super': 'error', | ||
'no-shadow-restricted-names': 'error', | ||
'no-empty': 'error', | ||
'no-shadow': 'error', | ||
'no-sparse-arrays': 'error', | ||
'no-unsafe-finally': 'error', | ||
'no-unused-expressions': 'error', | ||
'@typescript-eslint/restrict-plus-operands': 'error', | ||
'use-isnan': 'error', | ||
'arrow-body-style': 'error', | ||
'@typescript-eslint/interface-name-prefix': ['error', 'never'], | ||
'new-parens': 'error', | ||
// TODO: when released, enable this rule | ||
// '@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'as' }], | ||
'@typescript-eslint/no-parameter-properties': 'error', | ||
'@typescript-eslint/no-unnecessary-qualifier': 'error', | ||
'no-floating-decimal': 'error', | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use | ||
}, | ||
}, | ||
}; |