forked from algorandfoundation/ARCs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'eslint-rollup-typescript-refactoring' into bugfix/sessi…
…on-cookie
- Loading branch information
Showing
3 changed files
with
81 additions
and
229 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 |
---|---|---|
@@ -1,161 +1,13 @@ | ||
module.exports = { | ||
extends: [ | ||
'standard', | ||
'plugin:import/errors', | ||
'plugin:import/warnings', | ||
'plugin:@typescript-eslint/recommended' | ||
], | ||
plugins: [ | ||
'unicorn', | ||
'@typescript-eslint' | ||
], | ||
parser: '@typescript-eslint/parser', | ||
root: true, | ||
extends: ['@mrcointreau/eslint-config-typescript'], | ||
parserOptions: { | ||
project: ['./tsconfig.eslint.json'] | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
node: { extensions: ['.js', '.mjs'] }, | ||
typescript: {} | ||
}, | ||
'import/parsers': { | ||
'@typescript-eslint/parser': ['.ts', '.tsx'] | ||
} | ||
}, | ||
rules: { | ||
// Enforce import order | ||
'import/order': ['error', { 'newlines-between': 'always', alphabetize: { order: 'asc', orderImportKind: 'asc' } }], | ||
|
||
// Imports should come first | ||
'import/first': 'error', | ||
|
||
// Other import rules | ||
'import/no-mutable-exports': 'error', | ||
|
||
// Allow unresolved imports | ||
'import/no-unresolved': 'off', | ||
|
||
// Allow paren-less arrow functions only when there's no braces | ||
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }], | ||
|
||
// Allow async-await | ||
'generator-star-spacing': 'off', | ||
|
||
// Allow debugger during development | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn', | ||
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn', | ||
|
||
// Prefer const over let | ||
'prefer-const': ['error', { | ||
destructuring: 'any', | ||
ignoreReadBeforeAssign: false | ||
}], | ||
|
||
// No single if in an 'else' block | ||
'no-lonely-if': 'error', | ||
|
||
// Force curly braces for control flow, | ||
// including if blocks with a single statement | ||
curly: ['error', 'all'], | ||
|
||
// No async function without await | ||
'require-await': 'error', | ||
|
||
// Force dot notation when possible | ||
'dot-notation': 'error', | ||
|
||
'no-var': 'error', | ||
|
||
// Force object shorthand where possible | ||
'object-shorthand': 'error', | ||
|
||
// No useless destructuring/importing/exporting renames | ||
'no-useless-rename': 'error', | ||
|
||
/**********************/ | ||
/* Unicorn Rules */ | ||
/**********************/ | ||
|
||
// Pass error message when throwing errors | ||
'unicorn/error-message': 'error', | ||
|
||
// Uppercase regex escapes | ||
'unicorn/escape-case': 'error', | ||
|
||
// Array.isArray instead of instanceof | ||
'unicorn/no-array-instanceof': 'error', | ||
|
||
// Prevent deprecated `new Buffer()` | ||
'unicorn/no-new-buffer': 'error', | ||
|
||
// Keep regex literals safe! | ||
'unicorn/no-unsafe-regex': 'off', | ||
|
||
// Lowercase number formatting for octal, hex, binary (0x12 instead of 0X12) | ||
'unicorn/number-literal-case': 'error', | ||
|
||
// ** instead of Math.pow() | ||
'unicorn/prefer-exponentiation-operator': 'error', | ||
|
||
// includes over indexOf when checking for existence | ||
'unicorn/prefer-includes': 'error', | ||
|
||
// String methods startsWith/endsWith instead of more complicated stuff | ||
'unicorn/prefer-starts-ends-with': 'error', | ||
|
||
// textContent instead of innerText | ||
'unicorn/prefer-text-content': 'error', | ||
|
||
// Enforce throwing type error when throwing error while checking typeof | ||
'unicorn/prefer-type-error': 'error', | ||
|
||
// Use new when throwing error | ||
'unicorn/throw-new-error': 'error', | ||
|
||
/**********************/ | ||
/* TypeScript Rules */ | ||
/**********************/ | ||
|
||
'@typescript-eslint/no-unused-vars': ['error', { args: 'all', argsIgnorePattern: '^_' }], | ||
'@typescript-eslint/consistent-type-exports': 'error', | ||
'@typescript-eslint/consistent-type-imports': 'error', | ||
'@typescript-eslint/indent': ['error', 2], | ||
// Per the docs, the root no-unused-vars should be disabled: | ||
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md | ||
'no-unused-vars': 'off', | ||
|
||
// https://github.com/typescript-eslint/typescript-eslint/blob/1cf9243/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors | ||
'no-undef': 'off', | ||
|
||
// For easier migration | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/consistent-indexed-object-style': 'off', | ||
'@typescript-eslint/naming-convention': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-member-accessibility': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/parameter-properties': 'off', | ||
'@typescript-eslint/no-empty-interface': 'off', | ||
'@typescript-eslint/ban-ts-ignore': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/ban-types': 'off', | ||
'@typescript-eslint/no-namespace': 'off', | ||
'@typescript-eslint/triple-slash-reference': 'off' | ||
}, | ||
reportUnusedDisableDirectives: true, | ||
ignorePatterns: [ | ||
'*.min.*', | ||
'*.d.ts', | ||
'dist', | ||
'LICENSE*', | ||
'output', | ||
'coverage', | ||
'public', | ||
'package-lock.json', | ||
'pnpm-lock.yaml', | ||
'yarn.lock', | ||
'__snapshots__' | ||
'package-lock.json' | ||
] | ||
} |
Oops, something went wrong.