Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type annotations #339

Merged
merged 44 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4da4827
Add JSDoc type annotations to project (rebased)
toasted-nutbread Nov 27, 2023
aabd761
Remove unneeded references
toasted-nutbread Nov 27, 2023
19f359a
Config updates
toasted-nutbread Nov 27, 2023
6a3dae0
Add extension error imports
toasted-nutbread Nov 27, 2023
c8ac0d4
Updates
toasted-nutbread Nov 27, 2023
208c43e
Update some common types
toasted-nutbread Nov 27, 2023
5dc1674
Update types
toasted-nutbread Nov 27, 2023
7aed9a3
Update types
toasted-nutbread Nov 27, 2023
ac562ca
Update types
toasted-nutbread Nov 27, 2023
d897c3b
Update dictionary importer
toasted-nutbread Nov 27, 2023
a96be7d
Update request builder
toasted-nutbread Nov 27, 2023
29317da
Update offscreen
toasted-nutbread Nov 27, 2023
fe9905e
Remove interface keywords
toasted-nutbread Nov 27, 2023
5e73878
Update test command
toasted-nutbread Nov 27, 2023
b931060
Update typescript imports
toasted-nutbread Nov 28, 2023
d5b1217
Use import map
toasted-nutbread Nov 28, 2023
14d12f6
Update timer types and such
toasted-nutbread Nov 28, 2023
58ae2ab
Revert "Use import map"
toasted-nutbread Nov 28, 2023
a834a57
Add @ts-nocheck comment to generated library code
toasted-nutbread Nov 28, 2023
ec67de5
Update library types
toasted-nutbread Nov 28, 2023
e215656
Update types
toasted-nutbread Nov 30, 2023
4a14a0f
Update manifest types
toasted-nutbread Nov 30, 2023
59685d0
Update types
toasted-nutbread Nov 30, 2023
fd8be74
Update types
toasted-nutbread Nov 30, 2023
4fc7d81
Remove old tests
toasted-nutbread Nov 30, 2023
9ed81f2
Update config
toasted-nutbread Nov 30, 2023
a0a6291
Update tests
toasted-nutbread Nov 30, 2023
bfcc9d3
Fix rollup type issue
toasted-nutbread Nov 30, 2023
f0c5ef6
Update types
toasted-nutbread Nov 30, 2023
01142ef
Update types
toasted-nutbread Nov 30, 2023
1c1c18f
Update types
toasted-nutbread Nov 30, 2023
176f3fc
Fix bug
toasted-nutbread Nov 30, 2023
43bc4e3
Remove old command
toasted-nutbread Nov 30, 2023
338d210
Update paths
toasted-nutbread Dec 1, 2023
1f7fe5b
Fix name
toasted-nutbread Dec 1, 2023
c563e5b
Re-enable actions on save
toasted-nutbread Dec 3, 2023
083b474
Fix some import orderings
toasted-nutbread Dec 3, 2023
97bc188
Remove unused types
toasted-nutbread Dec 3, 2023
3d033c9
Update config
toasted-nutbread Dec 3, 2023
4f24982
Update imports
toasted-nutbread Dec 3, 2023
4b80a48
Adjust settings
toasted-nutbread Dec 3, 2023
dcddbee
Update how ts comments are handled
toasted-nutbread Dec 4, 2023
c0fbdec
Restore no-console warn
toasted-nutbread Dec 4, 2023
23e6fb7
Update package lock
toasted-nutbread Dec 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
djahandarie marked this conversation as resolved.
Show resolved Hide resolved
{
"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