-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.yml
114 lines (114 loc) · 4.4 KB
/
.eslintrc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
env:
browser: true
es2020: true
webextensions: true
extends:
# https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base/rules
- airbnb-base
- plugin:import/typescript
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
parser: "@typescript-eslint/parser"
plugins:
- "@typescript-eslint"
parserOptions:
ecmaVersion: 11
project:
- './tsconfig.json'
sourceType: module
settings:
# https://newbedev.com/using-eslint-with-typescript-unable-to-resolve-path-to-module
# https://stackoverflow.com/a/63451047/2625807
# https://stackoverflow.com/a/61065416/2625807
import/resolver:
typescript: {}
rules:
# might be worth bringing no-console back or stripping as part of
# the build once this is more mature - right now it's helpful in
# development
no-console: "off"
# Not sure of other easy UI available in an omnibox action
no-alert: "off"
# They're not wrong - I suspect I'm not using classes in a canonical
# way - just not ready to take this on yet.
class-methods-use-this:
- "off"
#
# Dangling commas on a function call/declaration just seems *wrong*,
# regardless of what the geniuses at AirBNB think.
#
comma-dangle:
- error
- arrays: always-multiline
objects: always-multiline
imports: always-multiline
exports: always-multiline
functions: never
dot-notation: "off"
"@typescript-eslint/dot-notation": warn
import/prefer-default-export:
# I build files incrementally, intending for more than one
# function to be within; having this tell me to default export the
# first function isn't helpful.
- "off"
import/extensions:
# doesn't seem compatible with esm support in node and typescript,
# where I import a .js filename that is satisfied by the
# .ts filename in my source
#
# https://stackoverflow.com/a/60675852/2625807
- "off"
# Disallow default exports, as they seem to stochastically cause
# babel+jest failures as of 2022-11
import/no-default-export:
- error
import/no-extraneous-dependencies:
- error
# Avoids this error:
# 'jest-chrome' should be listed in the project's dependencies, not devDependencies. []
- devDependencies:
- "**/*.test.tsx"
- "**/*.test.ts"
- "**/*.spec.ts"
- "**/*.spec.tsx"
- "jest.setup.js"
- "webpack.config.js"
# I don't know whether 'use strict' is the default in Chrome
# extensions, so let's assume not.
strict:
- error
- safe
# for of rules are not relevant when we are only extending modern browsers
#
# https://github.com/airbnb/javascript/issues/1271#issuecomment-548688952
no-restricted-syntax:
- error
- selector: 'ForInStatement'
message: "for..in loops iterate over the entire prototype chain, which is virtually never what you want.\
Use Object.{keys,values,entries}, and iterate over the resulting array."
# - selector: 'ForOfStatement'
# message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow \
# them. Separately, loops should be avoided in favor of array iterations.'
- selector: 'LabeledStatement'
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.'
- selector: 'WithStatement'
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.'
no-param-reassign:
- error
# this overrides the airbnb default. callbacks modifying DOM
# elements seem a reasonable thing to do, and the default of
# 'props: true' would make that difficult, as the increasingly
# ridiculous list of ways to fool the linter on this stackoverflow
# page suggests:
#
# https://stackoverflow.com/questions/35637770/how-to-avoid-no-param-reassign-when-setting-a-property-on-a-dom-object
- props: false
# https://github.com/typescript-eslint/typescript-eslint/issues/2540#issuecomment-692510509
no-use-before-define: "off"
# I couldn't figure out how to translate this; do I even have regexp literals configued to be used?
# new RegExp('/\\d+/(\\d+)/(\\d+)[/f]?');
prefer-regex-literals: "off"
"@typescript-eslint/no-use-before-define": warn
# arrow-body-style
# https://github.com/airbnb/javascript/blob/35914b14025cd52f53cd2ae2f353cdc7384087c0/packages/eslint-config-airbnb-base/rules/es6.js#L15-L20