Skip to content

Commit

Permalink
chore(linting): enable type checked linting (redwoodjs#11258)
Browse files Browse the repository at this point in the history
I'm not certain this is the perfect config setup with regards to
tsconfig files. Especially since we have different approaches to
tsconfig across our various packages.

The do have docs on monorepo type setups:
https://typescript-eslint.io/troubleshooting/typed-linting/monorepos#important-note-regarding-large--10-multi-package-monorepos.
I did run into OOM issues and so switched back to a single root tsconfig
specifically for eslint.
  • Loading branch information
Josh-Walker-GM authored Aug 15, 2024
1 parent 906b81e commit 0c60002
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
38 changes: 36 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,13 @@ module.exports = {
{
files: ['*.ts', '*.mts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: __dirname,
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
],
rules: {
// This is disabled for now because of our legacy usage of `require`. It should be enabled in the future.
Expand All @@ -192,6 +196,36 @@ module.exports = {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/prefer-function-type': 'off',
camelcase: 'off',

// TODO(jgmw): Work through these and either keep disabled or fix and re-enable
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/prefer-optional-chain': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/prefer-regexp-exec': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
'@typescript-eslint/no-implied-eval': 'off',
'@typescript-eslint/prefer-includes': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/no-duplicate-type-constituents': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/prefer-find': 'off',
},
},
{
Expand Down
4 changes: 4 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.compilerOption.json",
"exclude": ["dist", "node_modules", "**/__mocks__"]
}

0 comments on commit 0c60002

Please sign in to comment.