Skip to content

Commit 319683c

Browse files
authored
fix: use no-shadow of @typescript-eslint instead of base rule (toshi-toma#71)
1 parent ff2af94 commit 319683c

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

index.js

+3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ module.exports = {
2828
"@typescript-eslint/no-unused-vars": "error",
2929
"@typescript-eslint/explicit-member-accessibility": "off",
3030
"@typescript-eslint/no-object-literal-type-assertion": "off",
31+
// v4 changes
3132
"no-use-before-define": "off",
3233
"@typescript-eslint/no-use-before-define": ["error"],
34+
"no-shadow": "off",
35+
"@typescript-eslint/no-shadow": ["error"],
3336
// React
3437
"react/jsx-filename-extension": ["error", { extensions: [".tsx"] }],
3538
"react/prop-types": ["off", {}],

test/sample.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1+
import { Person, SampleData } from "./sampleTypes";
2+
13
function sum(a: number, b: number) {
24
return a + b;
35
}
46

57
sum(1, 2);
68

7-
interface Person {
8-
name: string;
9-
age: number;
10-
}
11-
129
function greeter(person: Person) {
1310
return `My name is ${person.name}. I am ${person.age} years old.`;
1411
}
1512

1613
greeter({ name: "toshi-toma", age: 24 });
14+
15+
function greeterWithEnum(person: SampleData) {
16+
return `My name is ${person.name}. I am ${person.age} years old.`;
17+
}
18+
19+
greeterWithEnum({ name: SampleData.name, age: SampleData.age });

test/sampleTypes.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface Person {
2+
name: string;
3+
age: number;
4+
}
5+
6+
export const enum SampleData {
7+
name = "toshi-toma",
8+
age = 24,
9+
}

0 commit comments

Comments
 (0)