Skip to content

Commit

Permalink
Merge pull request #339 from toasted-nutbread/type-annotations
Browse files Browse the repository at this point in the history
Type annotations
  • Loading branch information
djahandarie authored Dec 6, 2023
2 parents fd6bba8 + 23e6fb7 commit bd5bc1a
Show file tree
Hide file tree
Showing 280 changed files with 27,527 additions and 14,081 deletions.
275 changes: 264 additions & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@
"root": true,
"extends": [
"eslint:recommended",
"plugin:jsonc/recommended-with-json"
"plugin:jsonc/recommended-with-json",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"ecmaFeatures": {
"globalReturn": false,
"impliedStrict": true
}
},
"project": [
"./jsconfig.json",
"./dev/jsconfig.json",
"./test/jsconfig.json"
]
},
"env": {
"browser": true,
Expand All @@ -21,7 +28,10 @@
"no-unsanitized",
"header",
"jsdoc",
"jsonc"
"jsonc",
"unused-imports",
"@typescript-eslint",
"@stylistic/ts"
],
"ignorePatterns": [
"/ext/lib/",
Expand Down Expand Up @@ -56,7 +66,7 @@
"no-param-reassign": "off",
"no-prototype-builtins": "error",
"no-shadow": [
"error",
"off",
{
"builtinGlobals": false
}
Expand Down Expand Up @@ -253,29 +263,47 @@
"jsdoc/multiline-blocks": "error",
"jsdoc/no-bad-blocks": "error",
"jsdoc/no-multi-asterisks": "error",
"jsdoc/no-undefined-types": 1,
"jsdoc/no-undefined-types": "error",
"jsdoc/require-asterisk-prefix": "error",
"jsdoc/require-hyphen-before-param-description": [
"error",
"never"
],
"jsdoc/require-jsdoc": "off",
"jsdoc/require-jsdoc": [
"error",
{
"require": {
"ClassDeclaration": false,
"FunctionDeclaration": true,
"MethodDefinition": false
},
"contexts": [
"MethodDefinition[kind=constructor]>FunctionExpression>BlockStatement>ExpressionStatement>AssignmentExpression[left.object.type=ThisExpression]",
"ClassDeclaration>Classbody>PropertyDefinition",
"MethodDefinition[kind!=constructor][kind!=set]",
"MethodDefinition[kind=constructor][value.params.length>0]"
],
"checkGetters": "no-setter",
"checkSetters": "no-getter"
}
],
"jsdoc/require-description": "off",
"jsdoc/require-param": "error",
"jsdoc/require-param-description": "error",
"jsdoc/require-param-description": "off",
"jsdoc/require-param-name": "error",
"jsdoc/require-param-type": "error",
"jsdoc/require-property": "error",
"jsdoc/require-property-description": "error",
"jsdoc/require-property-description": "off",
"jsdoc/require-property-name": "error",
"jsdoc/require-property-type": "error",
"jsdoc/require-returns": "error",
"jsdoc/require-returns-check": "error",
"jsdoc/require-returns-description": "error",
"jsdoc/require-returns-description": "off",
"jsdoc/require-returns-type": "error",
"jsdoc/require-throws": "error",
"jsdoc/require-yields": "error",
"jsdoc/require-yields-check": "error",
"jsdoc/tag-lines": "error",
"jsdoc/tag-lines": ["error", "never", {"startLines": 0}],
"jsdoc/valid-types": "error",
"jsonc/indent": [
"error",
Expand Down Expand Up @@ -321,9 +349,169 @@
{
"allowAllPropertiesOnSameLine": true
}
]
],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-error": {
"descriptionFormat": "^ - .+$"
}
}
],
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"object": true
},
"extendDefaults": true
}
],
"@typescript-eslint/consistent-type-exports": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-shadow": [
"error",
{
"builtinGlobals": false
}
],
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off"
},
"overrides": [
{
"files": [
"*.ts"
],
"rules": {
"no-undef": "off",
"unused-imports/no-unused-imports": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"vars": "local",
"args": "after-used",
"argsIgnorePattern": "^_",
"caughtErrors": "none"
}
],
"comma-dangle": "off",
"@typescript-eslint/comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "always-multiline",
"enums": "always-multiline",
"generics": "always-multiline",
"tuples": "always-multiline"
}
],
"@stylistic/ts/block-spacing": "off",
"@stylistic/ts/brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"@stylistic/ts/comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "always-multiline",
"enums": "always-multiline",
"generics": "always-multiline",
"tuples": "always-multiline"
}
],
"@stylistic/ts/comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"@stylistic/ts/function-call-spacing": [
"error",
"never"
],
"@stylistic/ts/indent": [
"error",
4
],
"@stylistic/ts/key-spacing": [
"error",
{
"beforeColon": false,
"afterColon": true,
"mode": "strict"
}
],
"@stylistic/ts/keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
"@stylistic/ts/lines-around-comment": "off",
"@stylistic/ts/lines-between-class-members": [
"error",
"always"
],
"@stylistic/ts/member-delimiter-style": [
"error",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "comma",
"requireLast": false
},
"multilineDetection": "brackets"
}
],
"@stylistic/ts/no-extra-parens": [
"error",
"all"
],
"@stylistic/ts/no-extra-semi": "error",
"@stylistic/ts/object-curly-spacing": [
"error",
"never"
],
"@stylistic/ts/padding-line-between-statements": "off",
"@stylistic/ts/quotes": [
"error",
"single",
"avoid-escape"
],
"@stylistic/ts/semi": "error",
"@stylistic/ts/space-before-blocks": [
"error",
"always"
],
"@stylistic/ts/space-before-function-paren": [
"error",
{
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}
],
"@stylistic/ts/space-infix-ops": "error",
"@stylistic/ts/type-annotation-spacing": "error"
}
},
{
"files": [
"*.json"
Expand Down Expand Up @@ -373,12 +561,67 @@
{
"files": [
"ext/js/core.js",
"ext/js/core/extension-error.js",
"ext/js/**/sandbox/**/*.js"
],
"env": {
"webextensions": false
}
},
{
"files": [
"ext/**/*.js"
],
"excludedFiles": [
"ext/js/core/extension-error.js"
],
"globals": {
"ExtensionError": "readonly"
}
},
{
"files": [
"ext/**/*.js"
],
"excludedFiles": [
"ext/js/core.js",
"ext/js/core/extension-error.js",
"ext/js/accessibility/google-docs.js",
"ext/js/**/sandbox/**/*.js"
],
"globals": {
"isObject": "readonly",
"stringReverse": "readonly",
"promiseTimeout": "readonly",
"escapeRegExp": "readonly",
"deferPromise": "readonly",
"clone": "readonly",
"deepEqual": "readonly",
"generateId": "readonly",
"promiseAnimationFrame": "readonly",
"invokeMessageHandler": "readonly",
"log": "readonly",
"DynamicProperty": "readonly",
"EventDispatcher": "readonly",
"EventListenerCollection": "readonly",
"Logger": "readonly"
}
},
{
"files": [
"ext/**/*.js"
],
"excludedFiles": [
"ext/js/core.js",
"ext/js/core/extension-error.js",
"ext/js/accessibility/google-docs.js",
"ext/js/yomitan.js",
"ext/js/**/sandbox/**/*.js"
],
"globals": {
"yomitan": "readonly"
}
},
{
"files": [
"ext/js/yomitan.js"
Expand Down Expand Up @@ -417,6 +660,7 @@
{
"files": [
"ext/js/core.js",
"ext/js/core/extension-error.js",
"ext/js/yomitan.js",
"ext/js/accessibility/accessibility-controller.js",
"ext/js/background/backend.js",
Expand Down Expand Up @@ -466,6 +710,7 @@
{
"files": [
"ext/js/core.js",
"ext/js/core/extension-error.js",
"ext/js/data/database.js",
"ext/js/data/json-schema.js",
"ext/js/general/cache-map.js",
Expand Down Expand Up @@ -524,6 +769,14 @@
"vitest/prefer-to-be": "off"
},
"env": {}
},
{
"files": [
"dev/lib/**/*.js"
],
"extends": [
"plugin:@typescript-eslint/disable-type-checked"
]
}
]
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"html-validate.vscode-html-validate",
"stylelint.vscode-stylelint"
]
}
Loading

0 comments on commit bd5bc1a

Please sign in to comment.