Skip to content

Commit

Permalink
fix: use no-shadow of @typescript-eslint instead of base rule (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
dohomi authored Nov 21, 2020
1 parent ff2af94 commit 319683c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ module.exports = {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-object-literal-type-assertion": "off",
// v4 changes
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
// React
"react/jsx-filename-extension": ["error", { extensions: [".tsx"] }],
"react/prop-types": ["off", {}],
Expand Down
13 changes: 8 additions & 5 deletions test/sample.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { Person, SampleData } from "./sampleTypes";

function sum(a: number, b: number) {
return a + b;
}

sum(1, 2);

interface Person {
name: string;
age: number;
}

function greeter(person: Person) {
return `My name is ${person.name}. I am ${person.age} years old.`;
}

greeter({ name: "toshi-toma", age: 24 });

function greeterWithEnum(person: SampleData) {
return `My name is ${person.name}. I am ${person.age} years old.`;
}

greeterWithEnum({ name: SampleData.name, age: SampleData.age });
9 changes: 9 additions & 0 deletions test/sampleTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface Person {
name: string;
age: number;
}

export const enum SampleData {
name = "toshi-toma",
age = 24,
}

0 comments on commit 319683c

Please sign in to comment.