Skip to content

Commit

Permalink
test(eslint-plugin): add test cases for explicit-member-accessibility
Browse files Browse the repository at this point in the history
where `readonly` is specified.
  • Loading branch information
rhysd committed Mar 5, 2019
1 parent 39b583c commit a70aae9
Showing 1 changed file with 43 additions and 0 deletions.
Expand Up @@ -36,6 +36,19 @@ class Test {
getX () {
return 1;
}
}
`,
},
{
filename: 'test.ts',
code: `
class Test {
protected readonly name: string
private readonly x: number
public readonly b: boolean
public getX () {
return this.x
}
}
`,
},
Expand Down Expand Up @@ -137,6 +150,36 @@ class Test {
public getX? () {
return this.x
}
}
`,
},
{
filename: 'test.ts',
code: `
class Test {
readonly x: number
public getX () {
return this.x
}
}
`,
errors: [
{
messageId: 'missingAccessibility',
data: {
type: 'class property',
name: 'x',
},
line: 3,
column: 3,
},
],
output: `
class Test {
public readonly x: number
public getX () {
return this.x
}
}
`,
},
Expand Down

0 comments on commit a70aae9

Please sign in to comment.