Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

chore(deps): update dependency eslint-config-airbnb-base to v13 #1183

Merged
merged 3 commits into from
Oct 9, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,350 changes: 739 additions & 611 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"user-home": "^2.0.0"
},
"devDependencies": {
"eslint-config-airbnb-base": "12.1.0",
"eslint-config-airbnb-base": "13.1.0",
"eslint-plugin-import": "2.14.0",
"jasmine-fix": "1.3.1",
"rimraf": "2.6.2"
Expand Down
18 changes: 10 additions & 8 deletions spec/linter-eslint-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ describe('The eslint provider for Linter', () => {
const messages = await lint(editor)
expect(messages.length).toBe(1)
expect(messages[0].severity).toBe('error')
expect(messages[0].excerpt).toBe('Expected 1 empty line after import ' +
'statement not followed by another import. (import/newline-after-import)')
expect(messages[0].excerpt).toBe('Expected 1 empty line after import '
+ 'statement not followed by another import. (import/newline-after-import)')

// Enable the option under test
// NOTE: Depends on mport/newline-after-import rule being marked as fixable
Expand Down Expand Up @@ -692,15 +692,17 @@ describe('The eslint provider for Linter', () => {
describe("registers an 'ESLint Fix' right click menu command", () => {
// NOTE: Reaches into the private data of the ContextMenuManager, there is
// no public method to check this though so...
expect(atom.contextMenu.itemSets.some(itemSet =>
expect(atom.contextMenu.itemSets.some(itemSet => (
// Matching selector...
itemSet.selector === 'atom-text-editor:not(.mini), .overlayer' &&
itemSet.items.some(item =>
itemSet.selector === 'atom-text-editor:not(.mini), .overlayer'
&& itemSet.items.some(item => (
// Matching command...
item.command === 'linter-eslint:fix-file' &&
item.command === 'linter-eslint:fix-file'
// Matching label
item.label === 'ESLint Fix' &&
&& item.label === 'ESLint Fix'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😻

// And has a function controlling display
typeof item.shouldDisplay === 'function')))
&& typeof item.shouldDisplay === 'function'
))
)))
})
})
9 changes: 4 additions & 5 deletions spec/worker-helpers-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { copyFileToTempDir } from './linter-eslint-spec'
const getFixturesPath = path => Path.join(__dirname, 'fixtures', path)


const globalNodePath = process.platform === 'win32' ?
Path.join(getFixturesPath('global-eslint'), 'lib') :
getFixturesPath('global-eslint')
const globalNodePath = process.platform === 'win32'
? Path.join(getFixturesPath('global-eslint'), 'lib')
: getFixturesPath('global-eslint')

function createConfig(overrides = {}) {
return Object.assign(
Expand Down Expand Up @@ -196,8 +196,7 @@ describe('Worker Helpers', () => {
const config = createConfig({
advanced: { disableEslintIgnore: true }
})
const relativePath =
Helpers.getRelativePath(fixtureDir, fixtureFile, config)
const relativePath = Helpers.getRelativePath(fixtureDir, fixtureFile, config)
expect(relativePath).toBe('ignored.js')
})

Expand Down
4 changes: 2 additions & 2 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ const generateInvalidTrace = async ({

return {
severity: 'error',
excerpt: `${titleText}. See the description for details. ` +
'Click the URL to open a new issue!',
excerpt: `${titleText}. See the description for details. `
+ 'Click the URL to open a new issue!',
url: newIssueURL,
location,
description: `${rangeText}\nOriginal message: ${message}`
Expand Down
14 changes: 7 additions & 7 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ let ignoreFixableRulesWhileTyping
* @param {[iterable]} ruleIds Iterable containing ruleIds to ignore
* @return {Object} Object containing properties for each rule to ignore
*/
const idsToIgnoredRules = ruleIds =>
const idsToIgnoredRules = ruleIds => (
Array.from(ruleIds).reduce(
// 0 is the severity to turn off a rule
(ids, id) => Object.assign(ids, { [id]: 0 })
, {}
)
(ids, id) => Object.assign(ids, { [id]: 0 }),
{}
))


module.exports = {
Expand Down Expand Up @@ -180,10 +180,10 @@ module.exports = {
// Black magic!
// Compares the private component property of the active TextEditor
// against the components of the elements
const evtIsActiveEditor = evt.path.some(elem =>
const evtIsActiveEditor = evt.path.some(elem => (
// Atom v1.19.0+
(elem.component && activeEditor.component &&
elem.component === activeEditor.component))
elem.component && activeEditor.component
&& elem.component === activeEditor.component))
// Only show if it was the active editor and it is a valid scope
return evtIsActiveEditor && hasValidScope(activeEditor, scopes)
}
Expand Down
4 changes: 2 additions & 2 deletions src/validate/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export const isValidPoint = (textBuffer, line, column) => {
return validPoint.isEqual([line, column])
}

export const throwIfInvalidPoint = (textBuffer, line, column) =>
export const throwIfInvalidPoint = (textBuffer, line, column) => (
throwIfFail(
`${line}:${column} isn't a valid point!`,
isValidPoint(textBuffer, line, column)
)
))

export const hasValidScope = (editor, validScopes) => editor.getCursors()
.some(cursor => cursor.getScopeDescriptor()
Expand Down
28 changes: 15 additions & 13 deletions src/worker-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ export function getNodePrefixPath() {
if (Cache.NODE_PREFIX_PATH === null) {
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'
try {
Cache.NODE_PREFIX_PATH =
ChildProcess.spawnSync(npmCommand, ['get', 'prefix'], {
env: Object.assign(Object.assign({}, process.env), { PATH: getPath() })
}).output[1].toString().trim()
Cache.NODE_PREFIX_PATH = ChildProcess.spawnSync(npmCommand, ['get', 'prefix'], {
env: Object.assign(Object.assign({}, process.env), { PATH: getPath() })
}).output[1].toString().trim()
} catch (e) {
const errMsg = 'Unable to execute `npm get prefix`. Please make sure ' +
'Atom is getting $PATH correctly.'
const errMsg = 'Unable to execute `npm get prefix`. Please make sure '
+ 'Atom is getting $PATH correctly.'
throw new Error(errMsg)
}
}
Expand Down Expand Up @@ -71,14 +70,18 @@ export function findESLintDirectory(modulesDir, config, projectPath) {
locationType = 'advanced specified'
eslintDir = Path.join(projectPath || '', cleanPath(config.advanced.localNodeModules), 'eslint')
}

if (isDirectory(eslintDir)) {
return {
path: eslintDir,
type: locationType,
}
} else if (config.global.useGlobalEslint) {
}

if (config.global.useGlobalEslint) {
throw new Error('ESLint not found, please ensure the global Node path is set correctly.')
}

return {
path: Cache.ESLINT_LOCAL_PATH,
type: 'bundled fallback',
Expand Down Expand Up @@ -115,10 +118,9 @@ export function getESLintInstance(fileDir, config, projectPath) {
}

export function getConfigPath(fileDir) {
const configFile =
findCached(fileDir, [
'.eslintrc.js', '.eslintrc.yaml', '.eslintrc.yml', '.eslintrc.json', '.eslintrc', 'package.json'
])
const configFile = findCached(fileDir, [
'.eslintrc.js', '.eslintrc.yaml', '.eslintrc.yml', '.eslintrc.json', '.eslintrc', 'package.json'
])
if (configFile) {
if (Path.basename(configFile) === 'package.json') {
// eslint-disable-next-line import/no-dynamic-require
Expand Down Expand Up @@ -218,6 +220,6 @@ export function getRules(cliEngine) {
* @return {boolean} Whether or not there were changes
*/
export function didRulesChange(currentRules, newRules) {
return !(currentRules.size === newRules.size &&
Array.from(currentRules.keys()).every(ruleId => newRules.has(ruleId)))
return !(currentRules.size === newRules.size
&& Array.from(currentRules.keys()).every(ruleId => newRules.has(ruleId)))
}