Skip to content

Commit

Permalink
new(eslint): Enable new rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles Johnson committed Dec 2, 2019
1 parent e733f7f commit f07d396
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/config-danger/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export function isRevert(): boolean {
export async function countChangesInFile(file: string): Promise<number> {
return new Promise(resolve => {
danger.git.diffForFile(file).then(d => {
const added = (d && d.added && d.added.split('\n').length) || 0;
const removed = (d && d.removed && d.removed.split('\n').length) || 0;
const added = (d?.added && d.added.split('\n').length) || 0;
const removed = (d?.removed && d.removed.split('\n').length) || 0;

resolve(added + removed);
});
Expand Down
5 changes: 5 additions & 0 deletions packages/config-eslint/presets/next.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ module.exports = {
'multiline-comment-style': 'off',
'multiline-ternary': ['error', 'never'],
'no-constant-condition': 'error',
'no-constructor-return': 'warn',
'no-div-regex': 'error',
'no-dupe-else-if': 'warn',
'no-implicit-coercion': 'error',
'no-import-assign': 'warn',
'no-native-reassign': 'error',
'no-negated-condition': 'error',
'no-setter-return': 'warn',
'no-useless-call': 'error',
'prefer-regex-literals': 'warn',
'require-atomic-updates': 'error',
Expand Down Expand Up @@ -152,12 +155,14 @@ module.exports = {
'unicorn/prefer-exponentiation-operator': 'error',
'unicorn/prefer-flat-map': 'error',
'unicorn/prefer-includes': 'error',
'unicorn/prefer-negative-index': 'warn',
'unicorn/prefer-node-append': 'error',
'unicorn/prefer-node-remove': 'error',
'unicorn/prefer-starts-ends-with': 'error',
'unicorn/prefer-string-slice': 'warn',
'unicorn/prefer-spread': 'off', // Currently broken
'unicorn/prefer-text-content': 'error',
'unicorn/prefer-trim-start-end': 'warn',
'unicorn/prefer-type-error': 'error',
'unicorn/regex-shorthand': 'error',
'unicorn/throw-new-error': 'error',
Expand Down
2 changes: 2 additions & 0 deletions packages/config-eslint/presets/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ module.exports = {
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/promise-function-async': 'off', // Conflicts with other async rules
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
Expand Down

0 comments on commit f07d396

Please sign in to comment.