Files
coder/site/.eslintrc.yaml
T
G r e y 8fde3ed52f chore: improve eslint, sb, tsc configs (#483)
Summary:

This commit is a bit of a shotgun fix for various project settings.
Realistically, they could've been separate commits, but this is
convenience for just getting things into a green state to unblock
further work.

Details:

- Use our version of TS in vscode plugins
- organize vscode/settings.json
- fix tsconfig.test and tsconfig.prod (removes errors in test files)
- only use prod tsconfig in webpack
- point .eslintrc to both test and prod configs
- cleanup storybook
- running eslint in my workspace was OOMing. I configured
  maxWorkers like we had in v1 to fix this.
- remove .storybook from code coverage
- remove .js files from code coverage --> after moving away
  from Next.js, we don't allowJS in our tsconfig anymore. We only
  use JS for configurations, it's not allowed in src code!
2022-03-18 10:26:13 -04:00

122 lines
3.7 KiB
YAML

---
env:
browser: true
commonjs: true
es6: true
jest: true
node: true
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
- plugin:import/recommended
- plugin:import/typescript
- plugin:react/recommended
- plugin:jsx-a11y/strict
- plugin:compat/recommended
- prettier
parser: "@typescript-eslint/parser"
parserOptions:
ecmaVersion: 2018
project: "./tsconfig.json"
sourceType: module
ecmaFeatures:
jsx: true
# REMARK(Grey): We might want to move this to repository root eventually to
# lint multiple projects (supply array to project property).
tsconfigRootDir: "./"
plugins:
- "@typescript-eslint"
- import
- react-hooks
- jest
- no-storage
root: true
rules:
"@typescript-eslint/brace-style":
["error", "1tbs", { "allowSingleLine": false }]
"@typescript-eslint/camelcase": "off"
"@typescript-eslint/explicit-function-return-type": "off"
"@typescript-eslint/explicit-module-boundary-types": "error"
"@typescript-eslint/method-signature-style": ["error", "property"]
"@typescript-eslint/no-floating-promises": error
"@typescript-eslint/no-invalid-void-type": error
# We're disabling the `no-namespace` rule to use a pattern of defining an interface,
# and then defining functions that operate on that data via namespace. This is helpful for
# dealing with immutable objects. This is a common pattern that shows up in some other
# large TypeScript projects, like VSCode.
# More details: https://github.com/coder/m/pull/9720#discussion_r697609528
"@typescript-eslint/no-namespace": "off"
"@typescript-eslint/no-unnecessary-boolean-literal-compare": error
"@typescript-eslint/no-unnecessary-condition": warn
"@typescript-eslint/no-unnecessary-type-assertion": warn
"@typescript-eslint/no-unused-vars":
- error
- argsIgnorePattern: "^_"
varsIgnorePattern: "^_"
"@typescript-eslint/no-use-before-define": "off"
"@typescript-eslint/object-curly-spacing": ["error", "always"]
"@typescript-eslint/triple-slash-reference": "off"
"brace-style": "off"
"curly": ["error", "all"]
eqeqeq: error
import/default: "off"
import/namespace: "off"
import/newline-after-import:
- error
- count: 1
import/no-named-as-default: "off"
import/no-named-as-default-member: "off"
import/prefer-default-export: "off"
jest/no-focused-tests: "error"
jsx-a11y/label-has-for: "off"
jsx-a11y/no-autofocus: "off"
no-console:
- warn
- allow:
- warn
- error
- info
- debug
no-dupe-class-members: "off"
no-restricted-imports:
- error
- paths:
- name: "@material-ui/core"
message:
"Use path imports to avoid pulling in unused modules. See:
https://material-ui.com/guides/minimizing-bundle-size/"
- name: "@material-ui/icons"
message:
"Use path imports to avoid pulling in unused modules. See:
https://material-ui.com/guides/minimizing-bundle-size/"
- name: "@material-ui/styles"
message:
"Use path imports to avoid pulling in unused modules. See:
https://material-ui.com/guides/minimizing-bundle-size/"
no-storage/no-browser-storage: error
no-unused-vars: "off"
"object-curly-spacing": "off"
react-hooks/exhaustive-deps: warn
react-hooks/rules-of-hooks: error
react/jsx-no-script-url:
- error
- - name: Link
props:
- to
- name: Button
props:
- href
- name: IconButton
props:
- href
react/prop-types: "off"
react/jsx-boolean-value: ["error", "never"]
react/jsx-curly-brace-presence:
- error
- children: ignore
settings:
react:
version: detect
import/resolver:
typescript: {}