-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eslint-plugin): [naming-convention] support the auto-accessor sy…
…ntax (#8084)
- Loading branch information
Showing
11 changed files
with
312 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/eslint-plugin/tests/rules/naming-convention/cases/autoAccessor.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { createTestCases } from './createTestCases'; | ||
|
||
createTestCases([ | ||
{ | ||
code: [ | ||
'class Ignored { accessor % = 10; }', | ||
'class Ignored { accessor #% = 10; }', | ||
'class Ignored { static accessor % = 10; }', | ||
'class Ignored { static accessor #% = 10; }', | ||
'class Ignored { private accessor % = 10; }', | ||
'class Ignored { private static accessor % = 10; }', | ||
'class Ignored { override accessor % = 10; }', | ||
'class Ignored { accessor "%" = 10; }', | ||
'class Ignored { protected accessor % = 10; }', | ||
'class Ignored { public accessor % = 10; }', | ||
'class Ignored { abstract accessor %; }', | ||
], | ||
options: { | ||
selector: 'autoAccessor', | ||
}, | ||
}, | ||
]); |
19 changes: 19 additions & 0 deletions
19
packages/eslint-plugin/tests/rules/naming-convention/cases/classicAccessor.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { createTestCases } from './createTestCases'; | ||
|
||
createTestCases([ | ||
{ | ||
code: [ | ||
'const ignored = { get %() {} };', | ||
'const ignored = { set "%"(ignored) {} };', | ||
'class Ignored { private get %() {} }', | ||
'class Ignored { private set "%"(ignored) {} }', | ||
'class Ignored { private static get %() {} }', | ||
'class Ignored { static get #%() {} }', | ||
'abstract class Ignored { abstract get %(): number }', | ||
'abstract class Ignored { abstract set %(ignored: number) }', | ||
], | ||
options: { | ||
selector: 'classicAccessor', | ||
}, | ||
}, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.