Skip to content

Commit

Permalink
Forbid TypeScript's private modifier in favour of hash names (#244)
Browse files Browse the repository at this point in the history
* Forbid TypeScript's private modifier

* Update snapshot
  • Loading branch information
Mrtenz committed Oct 31, 2022
1 parent 717b531 commit 1842f05
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/typescript/rules-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@
"no-new-symbol": "off",
"no-obj-calls": "off",
"no-redeclare": "off",
"no-restricted-syntax": [
"error",
{
"selector": "PropertyDefinition[accessibility='private'], MethodDefinition[accessibility='private'], TSParameterProperty[accessibility='private']",
"message": "Use a hash name instead."
}
],
"no-setter-return": "off",
"no-shadow": "off",
"no-this-before-super": "off",
Expand Down
10 changes: 10 additions & 0 deletions packages/typescript/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,15 @@ module.exports = {
'jsdoc/require-property-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/valid-types': 'off',

// Prefer hash names over TypeScript's `private` modifier.
'no-restricted-syntax': [
'error',
{
selector:
"PropertyDefinition[accessibility='private'], MethodDefinition[accessibility='private'], TSParameterProperty[accessibility='private']",
message: 'Use a hash name instead.',
},
],
},
};

0 comments on commit 1842f05

Please sign in to comment.