mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
feat(check): turn on noImplicitOverride (#25695)
Closes https://github.com/denoland/deno/issues/11836 Ref https://github.com/denoland/deno/issues/25162
This commit is contained in:
parent
7533492a78
commit
48ea4e3c92
9 changed files with 25 additions and 6 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1375,9 +1375,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_config"
|
name = "deno_config"
|
||||||
version = "0.34.2"
|
version = "0.34.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "764368ba1424ea74f9a28d8e2e7633f57d008e73f76b12bc272f6d5903ca1e08"
|
checksum = "187d7dd888a49bfda396632371139e940c5cf47b15bfcaeeb2ba50f82f6940ec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"deno_package_json",
|
"deno_package_json",
|
||||||
|
|
|
@ -65,7 +65,7 @@ winres.workspace = true
|
||||||
[dependencies]
|
[dependencies]
|
||||||
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
||||||
deno_cache_dir = { workspace = true }
|
deno_cache_dir = { workspace = true }
|
||||||
deno_config = { version = "=0.34.2", features = ["workspace", "sync"] }
|
deno_config = { version = "=0.34.3", features = ["workspace", "sync"] }
|
||||||
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||||
deno_doc = { version = "0.148.0", features = ["html", "syntect"] }
|
deno_doc = { version = "0.148.0", features = ["html", "syntect"] }
|
||||||
deno_graph = { version = "=0.82.1" }
|
deno_graph = { version = "=0.82.1" }
|
||||||
|
|
|
@ -1129,6 +1129,7 @@ impl Default for LspTsConfig {
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleDetection": "force",
|
"moduleDetection": "force",
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
"noImplicitOverride": {
|
"noImplicitOverride": {
|
||||||
"description": "Ensure overriding members in derived classes are marked with an override modifier.",
|
"description": "Ensure overriding members in derived classes are marked with an override modifier.",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": true,
|
||||||
"markdownDescription": "Ensure overriding members in derived classes are marked with an override modifier.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitOverride"
|
"markdownDescription": "Ensure overriding members in derived classes are marked with an override modifier.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitOverride"
|
||||||
},
|
},
|
||||||
"noImplicitReturns": {
|
"noImplicitReturns": {
|
||||||
|
|
|
@ -1154,6 +1154,7 @@ delete Object.prototype.__proto__;
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
"moduleDetection": "force",
|
"moduleDetection": "force",
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
|
|
5
tests/specs/check/no_implicit_override/__test__.jsonc
Normal file
5
tests/specs/check/no_implicit_override/__test__.jsonc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"args": "check main.ts",
|
||||||
|
"output": "main.out",
|
||||||
|
"exitCode": 1
|
||||||
|
}
|
5
tests/specs/check/no_implicit_override/main.out
Normal file
5
tests/specs/check/no_implicit_override/main.out
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Check file:///[WILDCARD]/main.ts
|
||||||
|
error: TS4114 [ERROR]: This member must have an 'override' modifier because it overrides a member in the base class 'Greet'.
|
||||||
|
greet() {}
|
||||||
|
~~~~~
|
||||||
|
at file:///[WILDCARD]/no_implicit_override/main.ts:6:3
|
7
tests/specs/check/no_implicit_override/main.ts
Normal file
7
tests/specs/check/no_implicit_override/main.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class Greet {
|
||||||
|
greet() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Welcome extends Greet {
|
||||||
|
greet() {}
|
||||||
|
}
|
|
@ -330,7 +330,7 @@ Deno.test(
|
||||||
function urlSearchParamsOverridingAppendNotChangeConstructorAndSet() {
|
function urlSearchParamsOverridingAppendNotChangeConstructorAndSet() {
|
||||||
let overriddenAppendCalled = 0;
|
let overriddenAppendCalled = 0;
|
||||||
class CustomSearchParams extends URLSearchParams {
|
class CustomSearchParams extends URLSearchParams {
|
||||||
append(name: string, value: string) {
|
override append(name: string, value: string) {
|
||||||
++overriddenAppendCalled;
|
++overriddenAppendCalled;
|
||||||
super.append(name, value);
|
super.append(name, value);
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ Deno.test(
|
||||||
|
|
||||||
Deno.test(function urlSearchParamsOverridingEntriesNotChangeForEach() {
|
Deno.test(function urlSearchParamsOverridingEntriesNotChangeForEach() {
|
||||||
class CustomSearchParams extends URLSearchParams {
|
class CustomSearchParams extends URLSearchParams {
|
||||||
*entries(): IterableIterator<[string, string]> {
|
override *entries(): IterableIterator<[string, string]> {
|
||||||
yield* [];
|
yield* [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue