Skip to content

Commit

Permalink
Fix some lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 18, 2017
1 parent f87990a commit 34ab00b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion config/overrides.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
module.exports = {
// put rule overrides here
// Put rule overrides here
};
6 changes: 3 additions & 3 deletions config/plugins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
module.exports = {
// repeated here from eslint-config-xo in case some plugins set something different
// Repeated here from eslint-config-xo in case some plugins set something different
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module',
Expand Down Expand Up @@ -32,7 +32,7 @@ module.exports = {
'promise/param-names': 'error',
'promise/no-promise-in-callback': 'error',
'promise/no-callback-in-promise': 'error',
// enable this sometime in the future when Node.js has async/await support
// Enable this sometime in the future when Node.js has async/await support
// 'promise/prefer-await-to-then': 'error',
'import/default': 'error',
'import/export': 'error',
Expand All @@ -49,7 +49,7 @@ module.exports = {
'import/newline-after-import': 'error',
'import/no-amd': 'error',
'import/no-duplicates': 'error',
// enable this sometime in the future when Node.js has ES2015 module support
// Enable this sometime in the future when Node.js has ES2015 module support
// 'import/unambiguous': 'error',
// enable this sometime in the future when Node.js has ES2015 module support
// 'import/no-commonjs': 'error',
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ exports.lintFiles = (pattern, opts) => {
const glob = patterns.concat(gitIgnores);

return globby(glob, {ignore: opts.ignores, nodir: true}).then(paths => {
// filter out unwanted file extensions
// Filter out unwanted file extensions
// for silly users that don't specify an extension in the glob pattern
paths = paths.filter(x => {
// Remove dot before the actual extension
Expand All @@ -85,7 +85,7 @@ exports.lintFiles = (pattern, opts) => {
};

function mergeReports(reports) {
// merge multiple reports into a single report
// Merge multiple reports into a single report
let results = [];
let errorCount = 0;
let warningCount = 0;
Expand Down
10 changes: 5 additions & 5 deletions options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const DEFAULT_CONFIG = {
function normalizeOpts(opts) {
opts = Object.assign({}, opts);

// alias to help humans
// Alias to help humans
[
'env',
'global',
Expand Down Expand Up @@ -81,7 +81,7 @@ function mergeWithPkgConf(opts) {
return Object.assign({}, conf, opts);
}

// define the shape of deep properties for deepAssign
// Define the shape of deep properties for deepAssign
function emptyOptions() {
return {
rules: {},
Expand All @@ -104,7 +104,7 @@ function buildConfig(opts) {
const spaces = typeof opts.space === 'number' ? opts.space : 2;
config.rules.indent = ['error', spaces, {SwitchCase: 1}];

// only apply if the user has the React plugin
// Only apply if the user has the React plugin
if (opts.cwd && resolveFrom(opts.cwd, 'eslint-plugin-react')) {
config.plugins = config.plugins.concat('react');
config.rules['react/jsx-indent-props'] = ['error', spaces];
Expand Down Expand Up @@ -140,12 +140,12 @@ function buildConfig(opts) {
// TODO: this logic needs to be improved, preferably use the same code as ESLint
// user's configs must be resolved to their absolute paths
const configs = opts.extends.map(name => {
// don't do anything if it's a filepath
// Don't do anything if it's a filepath
if (pathExists.sync(name)) {
return name;
}

// don't do anything if it's a config from a plugin
// Don't do anything if it's a config from a plugin
if (name.startsWith('plugin:')) {
return name;
}
Expand Down
2 changes: 1 addition & 1 deletion test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test('overrides fixture', async () => {
// https://github.com/sindresorhus/xo/issues/65
test.failing('ignores fixture', async t => {
const cwd = path.join(__dirname, 'fixtures/ignores');
t.throws(execa('../../../cli.js', ['--no-local'], {cwd}));
await t.throws(execa('../../../cli.js', ['--no-local'], {cwd}));
});

test('ignore files in .gitignore', async t => {
Expand Down
8 changes: 4 additions & 4 deletions test/options-manager.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'path';
import test from 'ava';
import proxyquire from 'proxyquire';
import parentConfig from './fixtures/nested/package.json';
import childConfig from './fixtures/nested/child/package.json';
import parentConfig from './fixtures/nested/package';
import childConfig from './fixtures/nested/child/package';

process.chdir(__dirname);

Expand Down Expand Up @@ -40,7 +40,7 @@ test('normalizeOpts: falsie values stay falsie', t => {

test('buildConfig: defaults', t => {
const config = manager.buildConfig({});
t.true(/[\\\/]\.xo-cache[\\\/]?$/.test(config.cacheLocation));
t.true(/[\\/]\.xo-cache[\\/]?$/.test(config.cacheLocation));
t.is(config.useEslintrc, false);
t.is(config.cache, true);
t.is(config.baseConfig.extends[0], 'xo/esnext');
Expand All @@ -64,7 +64,7 @@ test('buildConfig: space: 4', t => {
test('buildConfig: semicolon', t => {
const config = manager.buildConfig({semicolon: false});
t.deepEqual(config.rules, {
'semi': ['error', 'never'],
semi: ['error', 'never'],
'semi-spacing': ['error', {
before: false,
after: true
Expand Down

0 comments on commit 34ab00b

Please sign in to comment.