-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lint rules (except naming) (#321)
Should also fix the data credit page --------- Co-authored-by: Luke Brody <lukebrody@pavonine.co> Co-authored-by: Kavi Gupta <kavi@berkeley.edu>
- Loading branch information
1 parent
8868694
commit c3f8449
Showing
70 changed files
with
11,595 additions
and
7,946 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,25 +1,110 @@ | ||
// @ts-check | ||
|
||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
import stylistic from '@stylistic/eslint-plugin' | ||
import comments from 'eslint-plugin-eslint-comments' | ||
import importPlugin from 'eslint-plugin-import' | ||
import tseslint from 'typescript-eslint' | ||
import reactPlugin from "eslint-plugin-react" | ||
import preferFC from 'eslint-plugin-react-prefer-function-component/config' | ||
import reactHooks from 'eslint-plugin-react-hooks' | ||
|
||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
...tseslint.configs.strict, | ||
...tseslint.configs.stylistic, | ||
{ | ||
files: ['**/*.{ts,tsx,mts,cts}'], | ||
rules: { | ||
'no-undef': 'off', | ||
}, | ||
}, | ||
{ | ||
ignores: ['**/*.js', 'src/utils/protos.d.ts'], | ||
}, | ||
{ | ||
rules: { | ||
"@typescript-eslint/no-require-imports": ["error", { allow: ['\\.json$']}], | ||
"@typescript-eslint/no-non-null-assertion": "off" | ||
} | ||
} | ||
); | ||
...tseslint.configs.strictTypeChecked, | ||
...tseslint.configs.stylisticTypeChecked, | ||
reactPlugin.configs.flat.recommended, | ||
{ | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
} | ||
}, | ||
preferFC.configs.recommended, | ||
{ | ||
plugins: { | ||
'react-hooks': reactHooks | ||
}, | ||
rules: reactHooks.configs.recommended.rules | ||
}, | ||
stylistic.configs.customize({ | ||
indent: 4, | ||
}), | ||
{ | ||
plugins: { | ||
import: importPlugin, | ||
}, | ||
rules: { | ||
...importPlugin.configs.recommended.rules, | ||
...importPlugin.configs.recommended.typescript, | ||
'import/order': ['error', { | ||
'alphabetize': { | ||
order: 'asc', | ||
}, | ||
'newlines-between': 'always', | ||
}], | ||
'import/no-unassigned-import': ['error', { | ||
allow: ['**/*.css'], | ||
}], | ||
'import/no-named-as-default-member': 'off', | ||
'import/namespace': 'off', | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
typescript: true, | ||
node: true, | ||
}, | ||
'import/parsers': { | ||
'@typescript-eslint/parser': ['.ts', '.tsx'], | ||
}, | ||
}, | ||
}, | ||
{ | ||
plugins: { 'eslint-comments': comments }, | ||
rules: comments.configs.recommended.rules, | ||
}, | ||
{ | ||
files: ['**/*.{ts,tsx,mts,cts}'], | ||
rules: { | ||
'no-undef': 'off', | ||
}, | ||
}, | ||
{ | ||
ignores: ['**/*.{js,mjs}', 'src/utils/protos.d.ts'], | ||
}, | ||
{ | ||
rules: { | ||
'@typescript-eslint/no-require-imports': ['error', { allow: ['\\.json$'] }], | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'prefer-template': 'error', | ||
'@typescript-eslint/restrict-template-expressions': 'off', | ||
'eslint-comments/no-unused-disable': 'error', | ||
'no-console': ['error', { "allow": ["warn", "error"] }], | ||
'@stylistic/max-statements-per-line': 'off', | ||
'@typescript-eslint/no-unnecessary-condition': ['error', { allowConstantLoopConditions: true }], | ||
'@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }], | ||
'@typescript-eslint/no-misused-promises': ['error', { | ||
checksVoidReturn: { | ||
attributes: false, | ||
arguments: false, | ||
}, | ||
}], | ||
'eqeqeq': 'error', | ||
'guard-for-in': 'error', | ||
'object-shorthand': 'error', | ||
'no-restricted-syntax': ['error', 'ExportNamedDeclaration:not([declaration])'], | ||
'react/prop-types': 'off', | ||
'no-shadow': 'error', | ||
'eslint-comments/require-description': ['error', { | ||
ignore: ['eslint-enable'] | ||
}], | ||
}, | ||
}, | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser', | ||
project: true, | ||
}, | ||
}, | ||
}, | ||
) |
Oops, something went wrong.