Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8fab926

Browse files
committedOct 30, 2024··
feat: remove dependencies for Node built-ins
1 parent c297d92 commit 8fab926

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+127
-269
lines changed
 

‎index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
'use strict';
22

3-
const fromEntries = require('object.fromentries');
4-
const entries = require('object.entries');
5-
63
const allRules = require('./lib/rules');
74

85
function filterRules(rules, predicate) {
9-
return fromEntries(entries(rules).filter((entry) => predicate(entry[1])));
6+
return Object.fromEntries(Object.entries(rules).filter((entry) => predicate(entry[1])));
107
}
118

129
/**
1310
* @param {object} rules - rules object mapping rule name to rule module
1411
* @returns {Record<string, 2 | 'error'>}
1512
*/
1613
function configureAsError(rules) {
17-
return fromEntries(Object.keys(rules).map((key) => [`react/${key}`, 2]));
14+
return Object.fromEntries(Object.keys(rules).map((key) => [`react/${key}`, 2]));
1815
}
1916

2017
/** @type {Partial<typeof allRules>} */

‎lib/rules/boolean-prop-naming.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,13 @@
55

66
'use strict';
77

8-
const flatMap = require('array.prototype.flatmap');
9-
const values = require('object.values');
10-
118
const Components = require('../util/Components');
129
const propsUtil = require('../util/props');
1310
const astUtil = require('../util/ast');
1411
const docsUrl = require('../util/docsUrl');
1512
const propWrapperUtil = require('../util/propWrapper');
1613
const report = require('../util/report');
17-
const eslintUtil = require('../util/eslint');
18-
19-
const getSourceCode = eslintUtil.getSourceCode;
20-
const getText = eslintUtil.getText;
14+
const { getSourceCode, getText } = require('../util/eslint');
2115

2216
/**
2317
* Checks if prop is nested
@@ -384,7 +378,7 @@ module.exports = {
384378
return;
385379
}
386380

387-
values(components.list()).forEach((component) => {
381+
Object.values(components.list()).forEach((component) => {
388382
const annotation = getComponentTypeAnnotation(component);
389383

390384
if (annotation) {
@@ -396,7 +390,7 @@ module.exports = {
396390
} else if (annotation.type === 'TSTypeReference') {
397391
propType = objectTypeAnnotations.get(annotation.typeName.name);
398392
} else if (annotation.type === 'TSIntersectionType') {
399-
propType = flatMap(annotation.types, (type) => (
393+
propType = annotation.types.flatMap((type) => (
400394
type.type === 'TSTypeReference'
401395
? objectTypeAnnotations.get(type.typeName.name)
402396
: type

0 commit comments

Comments
 (0)
Please sign in to comment.