apple1js/.eslintrc.json

215 lines
5.8 KiB
JSON
Raw Normal View History

{
2023-08-06 14:32:11 +00:00
// Global
"root": true,
2023-08-19 22:07:00 +00:00
"plugins": [
"prettier"
],
2023-08-06 14:32:11 +00:00
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
2023-08-19 22:07:00 +00:00
"plugin:prettier/recommended",
2023-08-06 14:32:11 +00:00
"plugin:jest/recommended"
],
"globals": {
"tapes": "writable"
},
"rules": {
"linebreak-style": [
2023-08-06 14:32:11 +00:00
"error",
"unix"
],
2023-08-06 14:32:11 +00:00
"eqeqeq": [
"error",
"smart"
],
"prefer-const": [
"error"
],
"no-var": "error",
"no-use-before-define": "off",
"no-console": [
"error",
{
"allow": [
"info",
"warn",
"error"
]
}
],
2023-08-19 22:07:00 +00:00
"prettier/prettier": "error",
2023-08-06 14:32:11 +00:00
// Jest configuration
"jest/expect-expect": [
"error",
{
"assertFunctionNames": [
"expect*",
"checkImageData",
"testCode"
]
}
]
},
"env": {
"builtin": true,
"browser": true,
"es6": true
},
"overrides": [
2023-08-06 14:32:11 +00:00
// All overrides matching a file are applied in-order, with the last
// taking precedence.
//
// TypeScript/TSX-specific configuration
{
2023-08-06 14:32:11 +00:00
"files": [
"*.ts",
"*.tsx"
],
"plugins": [
"@typescript-eslint/eslint-plugin"
],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"indent": [
"error",
2,
{
"SwitchCase": 1
}
],
// 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
}
]
},
"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"
}
},
// JS Node configuration
{
"files": [
"bin/*",
"babel.config.js",
"webpack.config.js"
],
"rules": {
"no-console": 0
},
"env": {
"node": true,
"jquery": false,
"browser": false
}
2023-08-06 14:32:11 +00:00
},
// Test configuration
{
"files": [
"test/**/*"
],
"env": {
2023-08-06 14:32:11 +00:00
"jest": true,
"jasmine": true,
"node": true
},
"rules": {
"no-console": 0
}
2023-08-06 14:32:11 +00:00
},
// Entry point configuration
{
"files": [
"js/entry2.ts",
"js/entry2e.ts",
"jest.config.js"
],
"env": {
"commonjs": true
}
2023-08-06 14:32:11 +00:00
},
// Worker configuration
{
"files": [
"workers/*"
],
"parserOptions": {
"project": "workers/tsconfig.json"
}
}
],
"ignorePatterns": [
"coverage/**/*"
],
"settings": {
"react": {
"pragma": "h",
"version": "16"
}
2023-08-06 14:32:11 +00:00
}
}