Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WRN-12748: Update eslint 8 related modules #13

Merged
merged 7 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "10"
- "node"
install:
- npm install
script:
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/display-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = {
// Special case for class properties
// (babel-eslint does not expose property name so we have to rely on tokens)
case 'ClassProperty':
case 'PropertyDefinition':
var tokens = sourceCode.getFirstTokens(node, 2);
if (
tokens[0].value === 'displayName' ||
Expand Down Expand Up @@ -145,7 +146,7 @@ module.exports = {

return {

ClassProperty: function(node) {
'ClassProperty, PropertyDefinition': function(node) {
if (!isDisplayNameDeclaration(node)) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/kind-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module.exports = {
// Special case for class properties
// (babel-eslint does not expose property name so we have to rely on tokens)
case 'ClassProperty':
case 'PropertyDefinition':
var tokens = sourceCode.getFirstTokens(node, 2);
if (
tokens[0].value === 'name' ||
Expand Down Expand Up @@ -148,7 +149,7 @@ module.exports = {

return {

ClassProperty: function(node) {
'ClassProperty, PropertyDefinition': function(node) {
if (!isNameDeclaration(node)) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module.exports = {
* @returns {Boolean} True if the node is a type annotated props declaration, false if not.
*/
function isAnnotatedClassPropsDeclaration(node) {
if (node && node.type === 'ClassProperty') {
if (node && (node.type === 'ClassProperty' || node.type === 'PropertyDefinition')) {
var tokens = context.getFirstTokens(node, 2);
if (
node.typeAnnotation && (
Expand Down Expand Up @@ -169,7 +169,7 @@ module.exports = {
function isPropTypesDeclaration(node) {
// Special case for class properties
// (babel-eslint does not expose property name so we have to rely on tokens)
if (node && node.type === 'ClassProperty') {
if (node && (node.type === 'ClassProperty' || node.type === 'PropertyDefinition')) {
var tokens = context.getFirstTokens(node, 2);
if (
tokens[0].value === 'propTypes' ||
Expand Down Expand Up @@ -983,7 +983,7 @@ module.exports = {
// --------------------------------------------------------------------------

return {
ClassProperty: function(node) {
'ClassProperty, PropertyDefinition': function(node) {
if (isAnnotatedClassPropsDeclaration(node)) {
markPropTypesAsDeclared(node, resolveTypeAnnotation(node));
} else if (isPropTypesDeclaration(node)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/util/Components.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ function componentRule(rule, context) {
components.add(node, 2);
},

ClassProperty: function(node) {
'ClassProperty, PropertyDefinition': function(node) {
node = utils.getParentComponent();
if (!node) {
return;
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"bugs": "https://github.com/enactjs/eslint-plugin-enact/issues",
"dependencies": {
"doctrine": "^3.0.0",
"jsx-ast-utils": "^3.2.1",
"minimatch": "^3.0.4"
"jsx-ast-utils": "^3.2.2",
"minimatch": "^5.0.1"
},
"peerDependencies": {
"eslint": ">=7.0.0"
"eslint": ">=8.0.0"
},
"engines": {
"node": ">=0.10"
"node": ">=10.16.0"
},
"keywords": [
"eslint",
Expand All @@ -39,7 +39,7 @@
],
"license": "Apache-2.0",
"devDependencies": {
"eslint": "^7.32.0",
"mocha": "^9.1.3"
"eslint": "^8.12.0",
"mocha": "^9.2.2"
}
}