Skip to content

Commit 5448e2e

Browse files
committed
[New] add support for @typescript-eslint/parser v5
1 parent 734b455 commit 5448e2e

25 files changed

+48
-33
lines changed

.github/workflows/node-4+.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
with:
7878
node-version: ${{ matrix.node-version }}
7979
after_install: |
80-
npm install --no-save "eslint@${{ matrix.eslint }}" "@typescript-eslint/parser@${{ matrix.node-version >= 14 && '4' || (matrix.node-version >= 12 && '4' || (matrix.node-version >= 10 && '4.0' || (matrix.node-version >= 8 && '3' || '2'))) }}" "babel-eslint@${{ matrix.babel-eslint }}"
80+
npm install --no-save "eslint@${{ matrix.eslint }}" "@typescript-eslint/parser@${{ matrix.node-version >= 14 && '5' || (matrix.node-version >= 12 && '4' || (matrix.node-version >= 10 && '4.0' || (matrix.node-version >= 8 && '3' || '2'))) }}" "babel-eslint@${{ matrix.babel-eslint }}"
8181
skip-ls-check: true
8282
env:
8383
NPM_CONFIG_LEGACY_PEER_DEPS: true

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
88
### Added
99
* [`no-unused-class-component-methods`]: Handle unused class component methods ([#2166][] @jakeleventhal @pawelnvk)
1010
* add [`no-arrow-function-lifecycle`] ([#1980][] @ngtan)
11+
* add support for `@typescript-eslint/parser` v5 (@ljharb)
1112

1213
### Fixed
1314
* `propTypes`: add `VoidFunctionComponent` to react generic list ([#3092][] @vedadeepta)

lib/rules/boolean-prop-naming.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ module.exports = {
233233
// --------------------------------------------------------------------------
234234

235235
return {
236-
ClassProperty(node) {
236+
'ClassProperty, PropertyDefinition'(node) {
237237
if (!rule || !propsUtil.isPropTypesDeclaration(node)) {
238238
return;
239239
}

lib/rules/destructuring-assignment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ module.exports = {
138138
function isInClassProperty(node) {
139139
let curNode = node.parent;
140140
while (curNode) {
141-
if (curNode.type === 'ClassProperty') {
141+
if (curNode.type === 'ClassProperty' || curNode.type === 'PropertyDefinition') {
142142
return true;
143143
}
144144
curNode = curNode.parent;
@@ -221,7 +221,7 @@ module.exports = {
221221

222222
if (
223223
classComponent && destructuringClass && configuration === 'never'
224-
&& !(ignoreClassFields && node.parent.type === 'ClassProperty')
224+
&& !(ignoreClassFields && (node.parent.type === 'ClassProperty' || node.parent.type === 'PropertyDefinition'))
225225
) {
226226
report(context, messages.noDestructAssignment, 'noDestructAssignment', {
227227
node,

lib/rules/display-name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ module.exports = {
124124
// --------------------------------------------------------------------------
125125

126126
return {
127-
ClassProperty(node) {
127+
'ClassProperty, PropertyDefinition'(node) {
128128
if (!propsUtil.isDisplayNameDeclaration(node)) {
129129
return;
130130
}

lib/rules/forbid-foreign-prop-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module.exports = {
6161
let parent = node.parent;
6262

6363
while (parent && parent.type !== 'Program') {
64-
if (parent.type === 'ClassProperty') {
64+
if (parent.type === 'ClassProperty' || parent.type === 'PropertyDefinition') {
6565
return parent;
6666
}
6767
parent = parent.parent;

lib/rules/forbid-prop-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ module.exports = {
156156
}
157157

158158
return {
159-
ClassProperty(node) {
159+
'ClassProperty, PropertyDefinition'(node) {
160160
if (
161161
!propsUtil.isPropTypesDeclaration(node)
162162
&& !shouldCheckContextTypes(node)

lib/rules/jsx-sort-default-props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ module.exports = {
165165
// --------------------------------------------------------------------------
166166

167167
return {
168-
ClassProperty(node) {
168+
'ClassProperty, PropertyDefinition'(node) {
169169
if (!isDefaultPropsDeclaration(node)) {
170170
return;
171171
}

lib/rules/no-arrow-function-lifecycle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = {
3232
return `: function(${params.join(', ')}) `;
3333
}
3434

35-
if (node.type === 'ClassProperty') {
35+
if (node.type === 'ClassProperty' || node.type === 'PropertyDefinition') {
3636
return `(${params.join(', ')}) `;
3737
}
3838

lib/rules/no-typos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ module.exports = {
201201
}
202202
},
203203

204-
ClassProperty(node) {
204+
'ClassProperty, PropertyDefinition'(node) {
205205
if (!node.static || !utils.isES6Component(node.parent.parent)) {
206206
return;
207207
}

0 commit comments

Comments
 (0)