2016-11-22 05:17:34 +00:00
|
|
|
{
|
2022-05-31 15:38:40 +00:00
|
|
|
// Global
|
|
|
|
"root": true,
|
2020-11-07 23:49:05 +00:00
|
|
|
"parser": "@typescript-eslint/parser",
|
2022-05-31 15:38:40 +00:00
|
|
|
"extends": [
|
|
|
|
"eslint:recommended",
|
|
|
|
"plugin:jest/recommended"
|
2022-05-29 20:48:51 +00:00
|
|
|
],
|
2016-11-22 05:17:34 +00:00
|
|
|
"rules": {
|
|
|
|
"indent": [
|
2020-11-07 23:49:05 +00:00
|
|
|
"error",
|
2020-11-26 01:28:37 +00:00
|
|
|
4,
|
|
|
|
{
|
|
|
|
"SwitchCase": 1
|
|
|
|
}
|
2019-01-09 08:51:25 +00:00
|
|
|
],
|
|
|
|
"quotes": [
|
2020-11-07 23:49:05 +00:00
|
|
|
"error",
|
2019-01-09 08:51:25 +00:00
|
|
|
"single"
|
|
|
|
],
|
|
|
|
"linebreak-style": [
|
2020-11-07 23:49:05 +00:00
|
|
|
"error",
|
2019-01-09 08:51:25 +00:00
|
|
|
"unix"
|
|
|
|
],
|
2022-05-31 15:38:40 +00:00
|
|
|
"eqeqeq": [
|
2020-11-07 23:49:05 +00:00
|
|
|
"error",
|
2022-05-31 15:38:40 +00:00
|
|
|
"smart"
|
2019-10-17 03:18:53 +00:00
|
|
|
],
|
2022-05-31 15:38:40 +00:00
|
|
|
"prefer-const": [
|
|
|
|
"error"
|
2022-05-10 15:04:20 +00:00
|
|
|
],
|
2022-05-31 15:38:40 +00:00
|
|
|
"no-var": "error",
|
2020-11-07 23:49:05 +00:00
|
|
|
"no-use-before-define": "off",
|
2020-01-02 19:11:04 +00:00
|
|
|
"no-console": [
|
2020-11-07 23:49:05 +00:00
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"allow": [
|
|
|
|
"info",
|
|
|
|
"warn",
|
|
|
|
"error"
|
|
|
|
]
|
|
|
|
}
|
2022-05-10 13:52:06 +00:00
|
|
|
],
|
2022-05-31 15:38:40 +00:00
|
|
|
// Jest configuration
|
|
|
|
"jest/expect-expect": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"assertFunctionNames": [
|
|
|
|
"expect*",
|
|
|
|
"checkImageData",
|
|
|
|
"testCode"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
2016-11-22 05:17:34 +00:00
|
|
|
},
|
|
|
|
"env": {
|
2019-01-09 08:51:25 +00:00
|
|
|
"builtin": true,
|
2016-11-22 05:17:34 +00:00
|
|
|
"browser": true,
|
2019-03-01 05:21:18 +00:00
|
|
|
"es6": true
|
|
|
|
},
|
2019-03-03 06:46:37 +00:00
|
|
|
"overrides": [
|
2022-05-31 15:38:40 +00:00
|
|
|
// All overrides matching a file are applied in-order, with the last
|
|
|
|
// taking precedence.
|
|
|
|
//
|
|
|
|
// TypeScript/TSX-specific configuration
|
2019-03-03 06:46:37 +00:00
|
|
|
{
|
2020-11-07 23:49:05 +00:00
|
|
|
"files": [
|
2022-05-31 15:38:40 +00: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 23:49:05 +00:00
|
|
|
],
|
|
|
|
"rules": {
|
2022-05-31 15:38:40 +00: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 23:49:05 +00:00
|
|
|
}
|
|
|
|
},
|
2022-05-31 15:38:40 +00:00
|
|
|
// JS Node configuration
|
2020-11-07 23:49:05 +00:00
|
|
|
{
|
|
|
|
"files": [
|
|
|
|
"bin/*",
|
|
|
|
"babel.config.js",
|
|
|
|
"webpack.config.js"
|
|
|
|
],
|
2019-03-03 06:46:37 +00:00
|
|
|
"rules": {
|
|
|
|
"no-console": 0
|
|
|
|
},
|
|
|
|
"env": {
|
|
|
|
"node": true,
|
|
|
|
"jquery": false,
|
|
|
|
"browser": false
|
|
|
|
}
|
2020-11-07 23:49:05 +00:00
|
|
|
},
|
2022-05-31 15:38:40 +00:00
|
|
|
// Test configuration
|
2020-11-07 23:49:05 +00:00
|
|
|
{
|
|
|
|
"files": [
|
|
|
|
"test/**/*"
|
|
|
|
],
|
2019-03-27 04:02:27 +00:00
|
|
|
"env": {
|
2019-09-19 01:46:26 +00:00
|
|
|
"jest": true,
|
2020-11-07 23:49:05 +00:00
|
|
|
"jasmine": true,
|
2019-09-19 01:46:26 +00:00
|
|
|
"node": true
|
2019-10-17 03:18:53 +00:00
|
|
|
},
|
|
|
|
"rules": {
|
|
|
|
"no-console": 0
|
2019-03-27 04:02:27 +00:00
|
|
|
}
|
2020-11-07 23:49:05 +00:00
|
|
|
},
|
2022-05-31 15:38:40 +00:00
|
|
|
// Entry point configuration
|
2020-11-07 23:49:05 +00:00
|
|
|
{
|
|
|
|
"files": [
|
2021-12-22 18:37:21 +00:00
|
|
|
"js/entry2.ts",
|
|
|
|
"js/entry2e.ts",
|
2020-11-07 23:49:05 +00:00
|
|
|
"jest.config.js"
|
|
|
|
],
|
2019-04-01 03:52:45 +00:00
|
|
|
"env": {
|
|
|
|
"commonjs": true
|
|
|
|
}
|
2021-07-07 00:04:02 +00:00
|
|
|
},
|
2022-05-31 15:38:40 +00:00
|
|
|
// Worker configuration
|
2021-07-07 00:04:02 +00:00
|
|
|
{
|
|
|
|
"files": [
|
|
|
|
"workers/*"
|
|
|
|
],
|
|
|
|
"parserOptions": {
|
|
|
|
"project": "workers/tsconfig.json"
|
|
|
|
}
|
2019-03-03 06:46:37 +00:00
|
|
|
}
|
2021-06-14 00:06:16 +00:00
|
|
|
],
|
2022-05-31 15:38:40 +00:00
|
|
|
"ignorePatterns": [
|
|
|
|
"coverage/**/*"
|
|
|
|
],
|
2022-05-10 13:52:06 +00:00
|
|
|
"settings": {
|
|
|
|
"react": {
|
2022-05-31 15:38:40 +00:00
|
|
|
"pragma": "h",
|
|
|
|
"version": "16"
|
2022-05-10 13:52:06 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-05 17:57:04 +00:00
|
|
|
}
|