Skip to content

Commit

Permalink
update dependencies and fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ganimomer committed Jun 17, 2018
1 parent 4bb3368 commit 2c3edb0
Show file tree
Hide file tree
Showing 39 changed files with 9,743 additions and 4,732 deletions.
8,008 changes: 8,008 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@
"eslint": ">=2.10.0"
},
"dependencies": {
"lodash": "~4.17.0"
"lodash": "4.17.10"
},
"devDependencies": {
"babel-cli": "6.24.1",
"babel-plugin-istanbul": "4.1.1",
"babel-cli": "6.26.0",
"babel-plugin-istanbul": "4.1.6",
"babel-preset-es2015": "6.24.1",
"babel-register": "6.24.1",
"coveralls": "2.13.0",
"cross-env": "4.0.0",
"eslint": "3.19.0",
"eslint-config-wix-editor": "0.2.3",
"eslint-plugin-eslint-plugin": "^0.8.0",
"babel-register": "6.26.0",
"coveralls": "3.0.1",
"cross-env": "5.2.0",
"eslint": "4.19.1",
"eslint-config-wix-editor": "3.4.0",
"eslint-plugin-eslint-plugin": "1.4.0",
"eslint-traverser": "1.5.2",
"istanbul": "^0.4.4",
"mocha": "3.3.0",
"nyc": "10.2.0",
"rimraf": "2.6.1"
"mocha": "5.2.0",
"nyc": "12.0.2",
"rimraf": "2.6.2"
},
"engines": {
"node": ">=0.12.0"
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const recommended = {
'lodash/chaining': 2,
'lodash/collection-method-value': 2,
'lodash/collection-return': 2,
'lodash/consistent-compose': [2, "flow"],
'lodash/consistent-compose': [2, 'flow'],
'lodash/identity-shorthand': [2, 'always'],
'lodash/import-scope': [2],
'lodash/matches-prop-shorthand': [2, 'always'],
Expand Down Expand Up @@ -72,7 +72,7 @@ module.exports = {
'lodash/chaining': [2, 'always'],
'lodash/collection-method-value': 2,
'lodash/collection-return': 2,
'lodash/consistent-compose': [2, "flow"],
'lodash/consistent-compose': [2, 'flow'],
'lodash/import-scope': [2, 'full'],
'lodash/identity-shorthand': [2, 'always'],
'lodash/matches-prop-shorthand': [2, 'always'],
Expand Down
1 change: 0 additions & 1 deletion src/rules/callback-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module.exports = {
const {getFunctionMaxArity} = require('../util/methodDataUtil')
const {getMethodName} = require('../util/astUtil')
const {version} = require('../util/settingsUtil').getSettings(context)
const includes = require('lodash/includes')

function isBound(node) {
return node && node.type === 'CallExpression' && getMethodName(node) === 'bind' && node.arguments.length === 1
Expand Down
2 changes: 1 addition & 1 deletion src/rules/chaining.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {

create(context) {
const {getLodashContext, isChainBreaker} = require('../util/lodashUtil')
const {getCaller, isMethodCall, isObjectOfMethodCall} = require('../util/astUtil')
const {isMethodCall, isObjectOfMethodCall} = require('../util/astUtil')
const DEFAULT_LENGTH = 3
const lodashContext = getLodashContext(context)
const version = lodashContext.version
Expand Down
1 change: 0 additions & 1 deletion src/rules/identity-shorthand.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,5 @@ module.exports = {
always: 'Prefer omitting the iteratee over a function that returns its argument',
never: 'Do not use the identity shorthand syntax'
})

}
}
6 changes: 2 additions & 4 deletions src/rules/import-scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ module.exports = {
if (isFullLodashImport(node.source.value)) {
if (importType === 'method' || importType === 'method-package') {
context.report({node, message: messages[importType]})
} else {
if (!allImportsAreOfType(node, importNodeTypes[importType])) {
context.report({node, message: messages[importType]})
}
} else if (!allImportsAreOfType(node, importNodeTypes[importType])) {
context.report({node, message: messages[importType]})
}
} else if ((isMethodImport(node.source.value) && importType !== 'method') ||
(isMethodPackageImport(node.source.value) && importType !== 'method-package')) {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-double-unwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
docs: {
url: getDocsUrl('no-double-unwrap')
},
fixable: "code"
fixable: 'code'
},

create(context) {
Expand Down
1 change: 0 additions & 1 deletion src/rules/path-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module.exports = {
const findIndex = require('lodash/findIndex')
const some = require('lodash/some')
const every = require('lodash/every')
const get = require('lodash/get')
const matches = require('lodash/matches')
const isPropAccess = x => x === '.' || x === '['

Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-lodash-chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
const version = lodashContext.version

const visitors = lodashContext.getImportVisitors()
visitors.CallExpression = function(node) {
visitors.CallExpression = function (node) {
if (lodashContext.isLodashChainStart(node)) {
do {
node = node.parent.parent
Expand Down
28 changes: 12 additions & 16 deletions src/rules/prefer-lodash-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,29 @@ module.exports = {
},

create(context) {

const {getLodashContext, isNativeCollectionMethodCall, getLodashMethodCallExpVisitor} = require('../util/lodashUtil')
const {getMethodName, getCaller} = require('../util/astUtil')
const {methodExists} = require('../util/methodDataUtil')
const keys = require('lodash/keys')
const get = require('lodash/get')
const includes = require('lodash/includes')
const matches = require('lodash/matches')
const some = require('lodash/some')
const map = require('lodash/map')
const assign = require('lodash/assign')
const ignoredMethods = get(context, ['options', 0, 'ignoreMethods'], [])
const ignoredObjects = get(context, ['options', 0, 'ignoreObjects'], [])
const usingLodash = new Set()

const nativeStringMap = {
endsWith: 'endsWith',
includes: 'includes',
padEnd: 'padEnd',
padStart: 'padStart',
repeat: 'repeat',
replace: 'replace',
split: 'split',
startsWith: 'startsWith',
toLowerCase: 'toLower',
toUpperCase: 'toUpper',
trim: 'trim'
endsWith: 'endsWith',
includes: 'includes',
padEnd: 'padEnd',
padStart: 'padStart',
repeat: 'repeat',
replace: 'replace',
split: 'split',
startsWith: 'startsWith',
toLowerCase: 'toLower',
toUpperCase: 'toUpper',
trim: 'trim'
}

const lodashContext = getLodashContext(context)
Expand Down Expand Up @@ -112,7 +108,7 @@ module.exports = {
if (!usingLodash.has(node) && !shouldIgnore(node) && canUseLodash(node)) {
let lodashMethodName = getMethodName(node)
if (isNativeStringMethodCall(node)) {
lodashMethodName = nativeStringMap[lodashMethodName]
lodashMethodName = nativeStringMap[lodashMethodName]
}
context.report({node, message: `Prefer '_.${lodashMethodName}' over the native function.`})
}
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-wrapper-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
const {isLodashWrapperMethod, getLodashContext} = require('../util/lodashUtil')
const lodashContext = getLodashContext(context)
const visitors = lodashContext.getImportVisitors()
visitors.CallExpression = function(node) {
visitors.CallExpression = function (node) {
if (lodashContext.isLodashChainStart(node) && isLodashWrapperMethod(node.arguments[0], lodashContext.version)) {
context.report({node, message: 'Prefer {{name}} with wrapper method over inside the chain start.', data: {name: node.arguments[0].callee.property.name}})
}
Expand Down
2 changes: 1 addition & 1 deletion src/rules/unwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {
}

const visitors = lodashContext.getImportVisitors()
visitors.CallExpression = function(node) {
visitors.CallExpression = function (node) {
if (lodashContext.isImplicitChainStart(node)) {
const end = getEndOfChain(node, false)
if (!isCommit(end) && isChainable(end, version)) {
Expand Down
2 changes: 1 addition & 1 deletion src/util/LodashContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = class {
case 'ImportNamespaceSpecifier':
case 'ImportDefaultSpecifier':
self.general[spec.local.name] = true
break
break
case 'ImportSpecifier':
self.methods[spec.local.name] = spec.imported.name
break
Expand Down
2 changes: 1 addition & 1 deletion src/util/getDocsUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ const REPO_URL = 'https://github.com/wix/eslint-plugin-lodash'
* @returns {string} URL to the documentation for the given rule
*/
module.exports = function getDocsUrl(ruleName) {
return `${REPO_URL}/blob/v${pkg.version}/docs/rules/${ruleName}.md`
return `${REPO_URL}/blob/v${pkg.version}/docs/rules/${ruleName}.md`
}
3 changes: 1 addition & 2 deletions src/util/lodashUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
const _ = require('lodash')
const methodDataUtil = require('./methodDataUtil')
const astUtil = require('./astUtil')
const settingsUtil = require('./settingsUtil')
const LodashContext = require('./LodashContext')

/**
Expand Down Expand Up @@ -148,7 +147,7 @@ function getLodashContext(context) {
module.exports = {
isChainable,
isChainBreaker,
isCallToMethod,
isCallToMethod,
isLodashWrapperMethod,
getIsTypeMethod,
isNativeCollectionMethodCall,
Expand Down
Loading

0 comments on commit 2c3edb0

Please sign in to comment.