Skip to content

Commit f7a5f7a

Browse files
authored
Replace separate Lodash packages with the core package (#569)
1 parent 2e273e9 commit f7a5f7a

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@
3838
"eslint-ast-utils": "^1.1.0",
3939
"eslint-template-visitor": "^1.1.0",
4040
"import-modules": "^2.0.0",
41-
"lodash.camelcase": "^4.3.0",
42-
"lodash.defaultsdeep": "^4.6.1",
43-
"lodash.kebabcase": "^4.1.1",
44-
"lodash.snakecase": "^4.1.1",
45-
"lodash.upperfirst": "^4.3.1",
41+
"lodash": "^4.17.15",
4642
"read-pkg-up": "^7.0.1",
4743
"regexp-tree": "^0.1.20",
4844
"reserved-words": "^0.1.2",

rules/custom-error-definition.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
'use strict';
2-
const upperfirst = require('lodash.upperfirst');
2+
const {upperFirst} = require('lodash');
33
const getDocumentationUrl = require('./utils/get-documentation-url');
44

55
const MESSAGE_ID_INVALID_EXPORT = 'invalidExport';
66

77
const nameRegexp = /^(?:[A-Z][\da-z]*)*Error$/;
88

9-
const getClassName = name => upperfirst(name).replace(/(?:error|)$/i, 'Error');
9+
const getClassName = name => upperFirst(name).replace(/(?:error|)$/i, 'Error');
1010

1111
const getConstructorMethod = className => `
1212
constructor() {

rules/filename-case.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
'use strict';
22
const path = require('path');
3-
const camelCase = require('lodash.camelcase');
4-
const kebabCase = require('lodash.kebabcase');
5-
const snakeCase = require('lodash.snakecase');
6-
const upperfirst = require('lodash.upperfirst');
3+
const {camelCase, kebabCase, snakeCase, upperFirst} = require('lodash');
74
const getDocumentationUrl = require('./utils/get-documentation-url');
85
const cartesianProductSamples = require('./utils/cartesian-product-samples');
96

10-
const pascalCase = string => upperfirst(camelCase(string));
7+
const pascalCase = string => upperFirst(camelCase(string));
118
const numberRegex = /\d+/;
129
const PLACEHOLDER = '\uFFFF\uFFFF\uFFFF';
1310
const PLACEHOLDER_REGEX = new RegExp(PLACEHOLDER, 'i');

rules/prevent-abbreviations.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
'use strict';
22
const path = require('path');
33
const astUtils = require('eslint-ast-utils');
4-
const defaultsDeep = require('lodash.defaultsdeep');
4+
const {defaultsDeep, upperFirst, lowerFirst} = require('lodash');
55

66
const getDocumentationUrl = require('./utils/get-documentation-url');
77
const avoidCapture = require('./utils/avoid-capture');
88
const cartesianProductSamples = require('./utils/cartesian-product-samples');
99

1010
const isUpperCase = string => string === string.toUpperCase();
1111
const isUpperFirst = string => isUpperCase(string[0]);
12-
const lowerFirst = string => string[0].toLowerCase() + string.slice(1);
13-
const upperFirst = string => string[0].toUpperCase() + string.slice(1);
1412

1513
// Keep this alphabetically sorted for easier maintenance
1614
const defaultReplacements = {

0 commit comments

Comments
 (0)