Skip to content

Commit

Permalink
feat: drop Node 4, 6, 8, 10, 12, 14 & 16 support
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Requires Node@^18.18.0 || ^20.9.0 || >=21.1.0
  • Loading branch information
MichaelDeBoey committed Oct 30, 2024
1 parent d1556a3 commit c297d92
Show file tree
Hide file tree
Showing 167 changed files with 478 additions and 620 deletions.
14 changes: 3 additions & 11 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"node": true
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 2022,
"ecmaFeatures": {
"jsx": true
},
Expand All @@ -34,17 +34,10 @@
"consistent-return": 0,

"prefer-destructuring": [2, { "array": false, "object": false }, { "enforceForRenamedProperties": false }],
"prefer-object-spread": 0, // until node 8 is required
"prefer-rest-params": 0, // until node 6 is required
"prefer-spread": 0, // until node 6 is required
"function-call-argument-newline": 1, // TODO: enable
"function-call-argument-newline": 1,
"function-paren-newline": 0,
"no-plusplus": [2, {"allowForLoopAfterthoughts": true}],
"no-param-reassign": 1,
"no-restricted-syntax": [2, {
"selector": "ObjectPattern",
"message": "Object destructuring is not compatible with Node v4"
}],
"strict": [2, "safe"],
"valid-jsdoc": [2, {
"requireReturn": false,
Expand Down Expand Up @@ -73,12 +66,11 @@
{
"files": ".github/workflows/*.js",
"parserOptions": {
"ecmaVersion": 2019,
"ecmaVersion": 2022,
},
"rules": {
"camelcase": 0,
"no-console": 0,
"no-restricted-syntax": 0,
},
},
],
Expand Down
117 changes: 0 additions & 117 deletions .github/workflows/node-minors.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/node-18+.yml → .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Tests: node.js (18+)'
name: 'Tests: node.js'

on: [pull_request, push]

Expand All @@ -14,7 +14,7 @@ jobs:
with:
versionsAsRoot: true
type: majors
preset: '>=18'
preset: '^18.18.0 || ^20.9.0 || >=21.1.0'

latest:
needs: [matrix]
Expand Down
12 changes: 6 additions & 6 deletions lib/rules/boolean-prop-naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ module.exports = {
}

const annotationTypeArguments = propsUtil.getTypeArguments(
component.node.parent.id.typeAnnotation.typeAnnotation
component.node.parent.id.typeAnnotation.typeAnnotation,
);
if (
annotationTypeArguments && (
Expand All @@ -269,7 +269,7 @@ module.exports = {
)
) {
return annotationTypeArguments.params.find(
(param) => param.type === 'TSTypeReference' || param.type === 'GenericTypeAnnotation'
(param) => param.type === 'TSTypeReference' || param.type === 'GenericTypeAnnotation',
);
}
}
Expand All @@ -278,7 +278,7 @@ module.exports = {
if (node.type === 'TSTypeLiteral' || node.type === 'ObjectTypeAnnotation' || node.type === 'TSInterfaceBody') {
const currentNode = [].concat(
objectTypeAnnotations.get(identifier.name) || [],
node
node,
);
objectTypeAnnotations.set(identifier.name, currentNode);
} else if (
Expand Down Expand Up @@ -317,7 +317,7 @@ module.exports = {
&& astUtil.isCallExpression(node.value)
&& propWrapperUtil.isPropWrapperFunction(
context,
getText(context, node.value.callee)
getText(context, node.value.callee),
)
) {
checkPropWrapperArguments(node, node.value.arguments);
Expand All @@ -343,7 +343,7 @@ module.exports = {
astUtil.isCallExpression(right)
&& propWrapperUtil.isPropWrapperFunction(
context,
getText(context, right.callee)
getText(context, right.callee),
)
) {
checkPropWrapperArguments(component.node, right.arguments);
Expand Down Expand Up @@ -407,7 +407,7 @@ module.exports = {
[].concat(propType).filter(Boolean).forEach((prop) => {
validatePropNaming(
component.node,
prop.properties || prop.members || prop.body
prop.properties || prop.members || prop.body,
);
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/button-has-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.exports = {
},

create(context) {
const configuration = Object.assign({}, optionDefaults, context.options[0]);
const configuration = { ...optionDefaults, ...context.options[0] };

function reportMissing(node) {
report(context, messages.missingType, 'missingType', {
Expand Down
10 changes: 5 additions & 5 deletions lib/rules/checked-requires-onchange-or-readonly.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ function extractTargetProps(properties, keyName) {
prop[keyName] && targetPropSet.has(prop[keyName].name)
? [prop[keyName].name]
: []
)
)
),
),
);
}

Expand All @@ -64,14 +64,14 @@ module.exports = {
}],
},
create(context) {
const options = Object.assign({}, defaultOptions, context.options[0]);
const options = { ...defaultOptions, ...context.options[0] };

function reportMissingProperty(node) {
report(
context,
messages.missingProperty,
'missingProperty',
{ node }
{ node },
);
}

Expand All @@ -80,7 +80,7 @@ module.exports = {
context,
messages.exclusiveCheckedAttribute,
'exclusiveCheckedAttribute',
{ node }
{ node },
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/default-props-match-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports = {
.forEach((component) => {
reportInvalidDefaultProps(
component.declaredPropTypes,
component.defaultProps || {}
component.defaultProps || {},
);
});
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/display-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ module.exports = {
// Report missing display name for all context objects
forEach(
filter(contextObjects.values(), (v) => !v.hasDisplayName),
(contextObj) => reportMissingContextDisplayName(contextObj)
(contextObj) => reportMissingContextDisplayName(contextObj),
);
}
},
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/forbid-component-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ module.exports = {
}

return options.allowPatternList.every(
(pattern) => !minimatch(tagName, pattern)
(pattern) => !minimatch(tagName, pattern),
);
}

Expand All @@ -193,7 +193,7 @@ module.exports = {
}

return options.disallowPatternList.some(
(pattern) => minimatch(tagName, pattern)
(pattern) => minimatch(tagName, pattern),
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/forbid-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module.exports = {
element,
message,
},
}
},
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/forward-ref-uses-ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ module.exports = {
const shouldAddParentheses = node.type === 'ArrowFunctionExpression' && !isParenthesized(context, param);
return [].concat(
shouldAddParentheses ? fixer.insertTextBefore(param, '(') : [],
fixer.insertTextAfter(param, `, ref${shouldAddParentheses ? ')' : ''}`)
fixer.insertTextAfter(param, `, ref${shouldAddParentheses ? ')' : ''}`),
);
},
}
},
),
Object.assign(
getMessageData('removeForwardRef', messages.removeForwardRef),
{
fix(fixer) {
return fixer.replaceText(node.parent, sourceCode.getText(node));
},
}
},
),
],
});
Expand Down
10 changes: 5 additions & 5 deletions lib/rules/function-component-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const propsUtil = require('../util/props');
function buildFunction(template, parts) {
return Object.keys(parts).reduce(
(acc, key) => acc.replace(`{${key}}`, () => parts[key] || ''),
template
template,
);
}

Expand Down Expand Up @@ -72,7 +72,7 @@ function getParams(node, source) {
if (node.params.length === 0) return null;
return source.slice(
node.params[0].range[0],
node.params[node.params.length - 1].range[1]
node.params[node.params.length - 1].range[1],
);
}

Expand Down Expand Up @@ -176,10 +176,10 @@ module.exports = {
let fileVarType = 'var';

const namedConfig = [].concat(
configuration.namedComponents || 'function-declaration'
configuration.namedComponents || 'function-declaration',
);
const unnamedConfig = [].concat(
configuration.unnamedComponents || 'function-expression'
configuration.unnamedComponents || 'function-expression',
);

function getFixer(node, options) {
Expand Down Expand Up @@ -214,7 +214,7 @@ module.exports = {
body: getBody(node, source),
name: getName(node),
varType,
})
}),
);
}

Expand Down
Loading

0 comments on commit c297d92

Please sign in to comment.