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

Commit

Permalink
Update eslint-config-airbnb-base to version 8.0.0 🚀 (#250)
Browse files Browse the repository at this point in the history
* chore(package): update eslint-config-airbnb-base to version 8.0.0

* chore(package): update eslint to version 3.6.0

* chore(package): update eslint-plugin-import to version 1.16.0

* Fix package activation in specs

This wasn't as broken as the others, but the ordering still wasn't
correct.

* Cleanup the specs

* A lot of `toEqual` changed to `toBe`
* Removal of redundant expects
* Move setting of settings out of the `waitsForPromise` blocks

* Fix lint issues
  • Loading branch information
greenkeeperio-bot authored and Arcanemagus committed Oct 13, 2016
1 parent ac6e034 commit e7bf260
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 78 deletions.
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
},
"devDependencies": {
"coffeelint": "^1.15.0",
"eslint": "^3.4.0",
"eslint-config-airbnb-base": "^7.0.0",
"eslint-plugin-import": "^1.14.0"
"eslint": "^3.6.0",
"eslint-config-airbnb-base": "^8.0.0",
"eslint-plugin-import": "^1.16.0"
},
"package-deps": [
"linter"
Expand All @@ -28,7 +28,6 @@
},
"eslintConfig": {
"rules": {
"comma-dangle": "off",
"global-require": "off",
"import/no-unresolved": [
"off",
Expand All @@ -44,7 +43,6 @@
"atom": true
},
"env": {
"es6": true,
"node": true
}
},
Expand Down
130 changes: 57 additions & 73 deletions spec/linter-flake8-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ describe('The flake8 provider for Linter', () => {
waitsForPromise(() =>
Promise.all([
atom.packages.activatePackage('linter-flake8'),
atom.packages.activatePackage('language-python').then(() =>
atom.workspace.open(goodPath)
)
])
atom.packages.activatePackage('language-python'),
]).then(() =>
atom.workspace.open(goodPath)
)
);
});

Expand All @@ -33,7 +33,7 @@ describe('The flake8 provider for Linter', () => {
let editor = null;
beforeEach(() => {
waitsForPromise(() =>
atom.workspace.open(badPath).then(openEditor => { editor = openEditor; })
atom.workspace.open(badPath).then((openEditor) => { editor = openEditor; })
);
});

Expand All @@ -47,16 +47,11 @@ describe('The flake8 provider for Linter', () => {

it('verifies that message', () =>
waitsForPromise(() =>
lint(editor).then(messages => {
expect(messages[0].type).toBeDefined();
expect(messages[0].type).toEqual('Warning');
lint(editor).then((messages) => {
expect(messages[0].type).toBe('Warning');
expect(messages[0].html).not.toBeDefined();
expect(messages[0].text).toBeDefined();
expect(messages[0].text).toEqual('F821 — undefined name \'asfd\'');
expect(messages[0].filePath).toBeDefined();
expect(messages[0].filePath).toMatch(/.+spec[\\\/]fixtures[\\\/]bad\.py$/);
expect(messages[0].range).toBeDefined();
expect(messages[0].range.length).toEqual(2);
expect(messages[0].text).toBe('F821 — undefined name \'asfd\'');
expect(messages[0].filePath).toBe(badPath);
expect(messages[0].range).toEqual([[0, 0], [0, 4]]);
})
)
Expand All @@ -65,10 +60,9 @@ describe('The flake8 provider for Linter', () => {
it('checks that the message is an error if flakeErrors is set', () => {
atom.config.set('linter-flake8.flakeErrors', true);
waitsForPromise(() =>
lint(editor).then(messages => {
expect(messages[0].type).toBeDefined();
expect(messages[0].type).toEqual('Error');
})
lint(editor).then(messages =>
expect(messages[0].type).toBe('Error')
)
);
});
});
Expand All @@ -78,7 +72,7 @@ describe('The flake8 provider for Linter', () => {

beforeEach(() => {
waitsForPromise(() =>
atom.workspace.open(errwarnPath).then(openEditor => { editor = openEditor; })
atom.workspace.open(errwarnPath).then((openEditor) => { editor = openEditor; })
);
});

Expand All @@ -93,20 +87,18 @@ describe('The flake8 provider for Linter', () => {
it('finds the message is a warning if pep8ErrorsToWarnings is set', () => {
atom.config.set('linter-flake8.pep8ErrorsToWarnings', true);
waitsForPromise(() =>
lint(editor).then(messages => {
expect(messages[0].type).toBeDefined();
expect(messages[0].type).toEqual('Warning');
})
lint(editor).then(messages =>
expect(messages[0].type).toBe('Warning')
)
);
});

it('finds the message is an error if pep8ErrorsToWarnings is set', () => {
atom.config.set('linter-flake8.pep8ErrorsToWarnings', false);
waitsForPromise(() =>
lint(editor).then(messages => {
expect(messages[0].type).toBeDefined();
expect(messages[0].type).toEqual('Error');
})
lint(editor).then(messages =>
expect(messages[0].type).toBe('Error')
)
);
});
});
Expand All @@ -115,7 +107,7 @@ describe('The flake8 provider for Linter', () => {
waitsForPromise(() =>
atom.workspace.open(goodPath).then(editor =>
lint(editor).then(messages =>
expect(messages.length).toEqual(0)
expect(messages.length).toBe(0)
)
)
);
Expand All @@ -137,73 +129,65 @@ describe('The flake8 provider for Linter', () => {

Object.defineProperty(helpers, 'exec', {
enumerable: true,
value: fakeExec
value: fakeExec,
});

waitsForPromise(() =>
atom.workspace.open(badPath).then(openEditor => { editor = openEditor; })
atom.workspace.open(badPath).then((openEditor) => { editor = openEditor; })
);
});

afterEach(() => {
Object.defineProperty(helpers, 'exec', {
enumerable: true,
value: realExec
value: realExec,
});
});

it('finds executable relative to project', () => {
waitsForPromise(() => {
atom.config.set('linter-flake8.executablePath',
path.join('$PROJECT', 'flake8')
);
return lint(editor).then(() => {
expect(execParams.pop()[0]).toEqual(
path.join(fixturePath, 'flake8')
);
});
});
atom.config.set('linter-flake8.executablePath',
path.join('$PROJECT', 'flake8')
);
waitsForPromise(() =>
lint(editor).then(() =>
expect(execParams.pop()[0]).toBe(path.join(fixturePath, 'flake8'))
)
);
});

it('finds executable using project name', () => {
waitsForPromise(() => {
atom.config.set('linter-flake8.executablePath',
path.join('$PROJECT_NAME', 'flake8')
);
return lint(editor).then(() => {
expect(execParams.pop()[0]).toEqual(
path.join('fixtures', 'flake8')
);
});
});
atom.config.set('linter-flake8.executablePath',
path.join('$PROJECT_NAME', 'flake8')
);
waitsForPromise(() =>
lint(editor).then(() =>
expect(execParams.pop()[0]).toBe(path.join('fixtures', 'flake8'))
)
);
});

it('normalizes executable path', () => {
waitsForPromise(() => {
atom.config.set('linter-flake8.executablePath',
path.join(fixturePath, '..', 'fixtures', 'flake8')
);
return lint(editor).then(() => {
expect(execParams.pop()[0]).toEqual(
path.join(fixturePath, 'flake8')
);
});
});
atom.config.set('linter-flake8.executablePath',
path.join(fixturePath, '..', 'fixtures', 'flake8')
);
waitsForPromise(() =>
lint(editor).then(() =>
expect(execParams.pop()[0]).toBe(path.join(fixturePath, 'flake8'))
)
);
});

it('finds backup executable', () => {
waitsForPromise(() => {
const flakeNotFound = path.join('$PROJECT', 'flake8_notfound');
const flakeBackup = path.join(fixturePath, 'flake8_backup');
atom.config.set('linter-flake8.executablePath',
`${flakeNotFound};${flakeBackup}`
);
return lint(editor).then(() => {
expect(execParams.pop()[0]).toEqual(
path.join(fixturePath, 'flake8_backup')
);
});
});
const flakeNotFound = path.join('$PROJECT', 'flake8_notfound');
const flakeBackup = path.join(fixturePath, 'flake8_backup');
atom.config.set('linter-flake8.executablePath',
`${flakeNotFound};${flakeBackup}`
);
waitsForPromise(() =>
lint(editor).then(() =>
expect(execParams.pop()[0]).toBe(path.join(fixturePath, 'flake8_backup'))
)
);
});
});
});

0 comments on commit e7bf260

Please sign in to comment.