2016-11-21 21:17:34 -08:00
|
|
|
{
|
2022-05-31 17:38:40 +02:00
|
|
|
// Global
|
|
|
|
"root": true,
|
2020-11-07 15:49:05 -08:00
|
|
|
"parser": "@typescript-eslint/parser",
|
2022-05-31 17:38:40 +02:00
|
|
|
"extends": [
|
|
|
|
"eslint:recommended",
|
|
|
|
"plugin:jest/recommended"
|
2022-05-29 13:48:51 -07:00
|
|
|
],
|
2016-11-21 21:17:34 -08:00
|
|
|
"rules": {
|
|
|
|
"indent": [
|
2020-11-07 15:49:05 -08:00
|
|
|
"error",
|
2020-11-25 17:28:37 -08:00
|
|
|
4,
|
|
|
|
{
|
|
|
|
"SwitchCase": 1
|
|
|
|
}
|
2019-01-09 00:51:25 -08:00
|
|
|
],
|
|
|
|
"quotes": [
|
2020-11-07 15:49:05 -08:00
|
|
|
"error",
|
2019-01-09 00:51:25 -08:00
|
|
|
"single"
|
|
|
|
],
|
|
|
|
"linebreak-style": [
|
2020-11-07 15:49:05 -08:00
|
|
|
"error",
|
2019-01-09 00:51:25 -08:00
|
|
|
"unix"
|
|
|
|
],
|
2022-05-31 17:38:40 +02:00
|
|
|
"eqeqeq": [
|
2020-11-07 15:49:05 -08:00
|
|
|
"error",
|
2022-05-31 17:38:40 +02:00
|
|
|
"smart"
|
2019-10-16 20:18:53 -07:00
|
|
|
],
|
2022-05-31 17:38:40 +02:00
|
|
|
"prefer-const": [
|
|
|
|
"error"
|
2022-05-10 08:04:20 -07:00
|
|
|
],
|
2022-05-31 17:38:40 +02:00
|
|
|
"no-var": "error",
|
2020-11-07 15:49:05 -08:00
|
|
|
"no-use-before-define": "off",
|
2020-01-02 11:11:04 -08:00
|
|
|
"no-console": [
|
2020-11-07 15:49:05 -08:00
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"allow": [
|
|
|
|
"info",
|
|
|
|
"warn",
|
|
|
|
"error"
|
|
|
|
]
|
|
|
|
}
|
2022-05-10 06:52:06 -07:00
|
|
|
],
|
2022-05-31 17:38:40 +02:00
|
|
|
// Jest configuration
|
|
|
|
"jest/expect-expect": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"assertFunctionNames": [
|
|
|
|
"expect*",
|
|
|
|
"checkImageData",
|
|
|
|
"testCode"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
2016-11-21 21:17:34 -08:00
|
|
|
},
|
|
|
|
"env": {
|
2019-01-09 00:51:25 -08:00
|
|
|
"builtin": true,
|
2016-11-21 21:17:34 -08:00
|
|
|
"browser": true,
|
2019-02-28 21:21:18 -08:00
|
|
|
"es6": true
|
|
|
|
},
|
2019-03-02 22:46:37 -08:00
|
|
|
"overrides": [
|
2022-05-31 17:38:40 +02:00
|
|
|
// All overrides matching a file are applied in-order, with the last
|
|
|
|
// taking precedence.
|
|
|
|
//
|
|
|
|
// TypeScript/TSX-specific configuration
|
2019-03-02 22:46:37 -08:00
|
|
|
{
|
2020-11-07 15:49:05 -08:00
|
|
|
"files": [
|
2022-05-31 17:38:40 +02:00
|
|
|
"*.ts",
|
|
|
|
"*.tsx"
|
|
|
|
],
|
|
|
|
"plugins": [
|
|
|
|
"@typescript-eslint/eslint-plugin"
|
|
|
|
],
|
|
|
|
"extends": [
|
|
|
|
"plugin:react/recommended",
|
|
|
|
"plugin:react-hooks/recommended",
|
|
|
|
"plugin:@typescript-eslint/recommended",
|
|
|
|
"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
2020-11-07 15:49:05 -08:00
|
|
|
],
|
|
|
|
"rules": {
|
2022-05-31 17:38:40 +02:00
|
|
|
// recommended is just "warn"
|
|
|
|
"@typescript-eslint/no-explicit-any": "error",
|
|
|
|
// enforce semicolons at ends of statements
|
|
|
|
"semi": "off",
|
|
|
|
"@typescript-eslint/semi": [
|
|
|
|
"error",
|
|
|
|
"always"
|
|
|
|
],
|
|
|
|
// enforce semicolons to separate members
|
|
|
|
"@typescript-eslint/member-delimiter-style": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"multiline": {
|
|
|
|
"delimiter": "semi",
|
|
|
|
"requireLast": true
|
|
|
|
},
|
|
|
|
"singleline": {
|
|
|
|
"delimiter": "semi",
|
|
|
|
"requireLast": false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
// definitions must come before uses for variables
|
|
|
|
"@typescript-eslint/no-use-before-define": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"functions": false,
|
|
|
|
"classes": false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
// no used variables
|
|
|
|
"no-unused-vars": "off",
|
|
|
|
"@typescript-eslint/no-unused-vars": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"argsIgnorePattern": "^_"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
// no redeclaration of classes, members or variables
|
|
|
|
"no-redeclare": "off",
|
|
|
|
"@typescript-eslint/no-redeclare": [
|
|
|
|
"error"
|
|
|
|
],
|
|
|
|
// allow empty interface definitions and empty extends
|
|
|
|
"@typescript-eslint/no-empty-interface": "off",
|
|
|
|
// allow explicit type declaration
|
|
|
|
"@typescript-eslint/no-inferrable-types": "off",
|
|
|
|
// allow some non-string types in templates
|
|
|
|
"@typescript-eslint/restrict-template-expressions": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"allowNumber": true,
|
|
|
|
"allowBoolean": true
|
|
|
|
}
|
|
|
|
],
|
|
|
|
// react rules
|
|
|
|
"react-hooks/rules-of-hooks": "error",
|
|
|
|
"react-hooks/exhaustive-deps": "error"
|
|
|
|
},
|
|
|
|
"parserOptions": {
|
|
|
|
"sourceType": "module",
|
|
|
|
"project": "./tsconfig.json"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// UI elements
|
|
|
|
{
|
|
|
|
"files": [
|
|
|
|
"js/ui/**.ts"
|
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
// allow non-null assertions since these classes reference the DOM
|
|
|
|
"@typescript-eslint/no-non-null-assertion": "off"
|
2020-11-07 15:49:05 -08:00
|
|
|
}
|
|
|
|
},
|
2022-05-31 17:38:40 +02:00
|
|
|
// JS Node configuration
|
2020-11-07 15:49:05 -08:00
|
|
|
{
|
|
|
|
"files": [
|
|
|
|
"bin/*",
|
|
|
|
"babel.config.js",
|
|
|
|
"webpack.config.js"
|
|
|
|
],
|
2019-03-02 22:46:37 -08:00
|
|
|
"rules": {
|
|
|
|
"no-console": 0
|
|
|
|
},
|
|
|
|
"env": {
|
|
|
|
"node": true,
|
|
|
|
"jquery": false,
|
|
|
|
"browser": false
|
|
|
|
}
|
2020-11-07 15:49:05 -08:00
|
|
|
},
|
2022-05-31 17:38:40 +02:00
|
|
|
// Test configuration
|
2020-11-07 15:49:05 -08:00
|
|
|
{
|
|
|
|
"files": [
|
|
|
|
"test/**/*"
|
|
|
|
],
|
2019-03-26 21:02:27 -07:00
|
|
|
"env": {
|
2019-09-18 18:46:26 -07:00
|
|
|
"jest": true,
|
2020-11-07 15:49:05 -08:00
|
|
|
"jasmine": true,
|
2019-09-18 18:46:26 -07:00
|
|
|
"node": true
|
2019-10-16 20:18:53 -07:00
|
|
|
},
|
|
|
|
"rules": {
|
|
|
|
"no-console": 0
|
2019-03-26 21:02:27 -07:00
|
|
|
}
|
2020-11-07 15:49:05 -08:00
|
|
|
},
|
2022-05-31 17:38:40 +02:00
|
|
|
// Entry point configuration
|
2020-11-07 15:49:05 -08:00
|
|
|
{
|
|
|
|
"files": [
|
2021-12-22 10:37:21 -08:00
|
|
|
"js/entry2.ts",
|
|
|
|
"js/entry2e.ts",
|
2020-11-07 15:49:05 -08:00
|
|
|
"jest.config.js"
|
|
|
|
],
|
2019-03-31 20:52:45 -07:00
|
|
|
"env": {
|
|
|
|
"commonjs": true
|
|
|
|
}
|
2021-07-06 17:04:02 -07:00
|
|
|
},
|
2022-05-31 17:38:40 +02:00
|
|
|
// Worker configuration
|
2021-07-06 17:04:02 -07:00
|
|
|
{
|
|
|
|
"files": [
|
|
|
|
"workers/*"
|
|
|
|
],
|
|
|
|
"parserOptions": {
|
|
|
|
"project": "workers/tsconfig.json"
|
|
|
|
}
|
2019-03-02 22:46:37 -08:00
|
|
|
}
|
2021-06-13 17:06:16 -07:00
|
|
|
],
|
2022-05-31 17:38:40 +02:00
|
|
|
"ignorePatterns": [
|
|
|
|
"coverage/**/*"
|
|
|
|
],
|
2022-05-10 06:52:06 -07:00
|
|
|
"settings": {
|
|
|
|
"react": {
|
2022-05-31 17:38:40 +02:00
|
|
|
"pragma": "h",
|
|
|
|
"version": "16"
|
2022-05-10 06:52:06 -07:00
|
|
|
}
|
|
|
|
}
|
2022-06-05 10:57:04 -07:00
|
|
|
}
|