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

Commit

Permalink
style: fix lint issues
Browse files Browse the repository at this point in the history
Update the code style to match the new `eslint-config-airbnb-base` 
version.
  • Loading branch information
Arcanemagus committed Sep 27, 2018
1 parent 212e486 commit 9816f17
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
40 changes: 19 additions & 21 deletions lib/helpers.js
Expand Up @@ -12,15 +12,14 @@ import type { TextEditor } from 'atom';
let homeConfigPath;
const debugCache = new Map();

const readFile = async filePath =>
new Promise((resolve, reject) => {
fsReadFile(filePath, 'utf8', (err, data) => {
if (err) {
reject(err);
}
resolve(data);
});
const readFile = async filePath => new Promise((resolve, reject) => {
fsReadFile(filePath, 'utf8', (err, data) => {
if (err) {
reject(err);
}
resolve(data);
});
});

export const isIgnored = async (filePath, ignorePath) => {
const fileDir = path.dirname(filePath);
Expand Down Expand Up @@ -49,9 +48,9 @@ export const isIgnored = async (filePath, ignorePath) => {

// Check using `test -d` for directory exclusions
if (
shjsTest('-d', filePath) &&
pattern.match(/^[^/\\]*[/\\]?$/) &&
filePath.match(new RegExp(`^${pattern}.*`))
shjsTest('-d', filePath)
&& pattern.match(/^[^/\\]*[/\\]?$/)
&& filePath.match(new RegExp(`^${pattern}.*`))
) {
return true;
}
Expand All @@ -60,15 +59,14 @@ export const isIgnored = async (filePath, ignorePath) => {
});
};

const fileExists = async checkPath =>
new Promise((resolve) => {
access(checkPath, (err) => {
if (err) {
resolve(false);
}
resolve(true);
});
const fileExists = async checkPath => new Promise((resolve) => {
access(checkPath, (err) => {
if (err) {
resolve(false);
}
resolve(true);
});
});

export const hasHomeConfig = async () => {
if (!homeConfigPath) {
Expand All @@ -86,8 +84,8 @@ function getPackageMeta() {
}

async function getJSHintVersion(config) {
const execPath = config.executablePath !== '' ? config.executablePath :
path.join(__dirname, '..', 'node_modules', 'jshint', 'bin', 'jshint');
const execPath = config.executablePath !== '' ? config.executablePath
: path.join(__dirname, '..', 'node_modules', 'jshint', 'bin', 'jshint');

if (debugCache.has(execPath)) {
return debugCache.get(execPath);
Expand Down
4 changes: 2 additions & 2 deletions lib/main.js
Expand Up @@ -133,8 +133,8 @@ module.exports = {
}
}

if (this.lintInlineJavaScript &&
textEditor.getGrammar().scopeName.indexOf('text.html') !== -1
if (this.lintInlineJavaScript
&& textEditor.getGrammar().scopeName.indexOf('text.html') !== -1
) {
parameters.push('--extract', 'always');
}
Expand Down
16 changes: 10 additions & 6 deletions spec/linter-jshint-spec.js
@@ -1,7 +1,9 @@
'use babel';

// eslint-disable-next-line no-unused-vars
import { it, fit, wait, beforeEach, afterEach } from 'jasmine-fix';
import {
// eslint-disable-next-line no-unused-vars
it, fit, wait, beforeEach, afterEach,
} from 'jasmine-fix';
import * as path from 'path';
import linter from '../lib/main';

Expand Down Expand Up @@ -35,11 +37,13 @@ describe('The JSHint provider for Linter', () => {
await atom.packages.activatePackage('language-javascript');
});

it('should be in the packages list', () =>
expect(atom.packages.isPackageLoaded('linter-jshint')).toBe(true));
it('should be in the packages list', () => {
expect(atom.packages.isPackageLoaded('linter-jshint')).toBe(true);
});

it('should be an active package', () =>
expect(atom.packages.isPackageActive('linter-jshint')).toBe(true));
it('should be an active package', () => {
expect(atom.packages.isPackageActive('linter-jshint')).toBe(true);
});

describe('shows errors in a file with issues', () => {
let editor = null;
Expand Down

0 comments on commit 9816f17

Please sign in to comment.