Skip to content

Commit

Permalink
Add explanations to some ESLint ignore comments (#704)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Jul 21, 2023
1 parent 50f52e3 commit 2452616
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cli.js
@@ -1,5 +1,5 @@
#!/usr/bin/env node
/* eslint-disable unicorn/prefer-top-level-await */
/* eslint-disable unicorn/prefer-top-level-await -- TODO: Use top-level await */
import process from 'node:process';
import getStdin from 'get-stdin';
import meow from 'meow';
Expand Down
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -89,7 +89,7 @@ const lintFiles = async (patterns, options) => {
const {cwd, baseConfig: {ignorePatterns}} = eslintOptions;
if (
micromatch.isMatch(path.relative(cwd, filePath), ignorePatterns)
// eslint-disable-next-line no-await-in-loop
// eslint-disable-next-line no-await-in-loop -- Not worth refactoring
|| await eslint.isPathIgnored(filePath)
) {
continue;
Expand Down
4 changes: 2 additions & 2 deletions lib/options-manager.js
Expand Up @@ -522,11 +522,11 @@ const findApplicableOverrides = (path, overrides) => {
const applicable = [];

for (const override of overrides) {
hash <<= 1; // eslint-disable-line no-bitwise
hash <<= 1; // eslint-disable-line no-bitwise -- Intentional bitwise usage

if (micromatch.isMatch(path, override.files)) {
applicable.push(override);
hash |= 1; // eslint-disable-line no-bitwise
hash |= 1; // eslint-disable-line no-bitwise -- Intentional bitwise usage
}
}

Expand Down
12 changes: 6 additions & 6 deletions test/lint-files.js
Expand Up @@ -228,19 +228,19 @@ test.serial('typescript files', async t => {

test.serial('typescript 2 space option', async t => {
const {errorCount, results} = await xo.lintFiles('two-spaces.tsx', {cwd: 'fixtures/typescript', space: 2});
// eslint-disable-next-line ava/assertion-arguments
// eslint-disable-next-line ava/assertion-arguments -- Type issue
t.is(errorCount, 0, JSON.stringify(results[0].messages));
});

test.serial('typescript 4 space option', async t => {
const {errorCount, results} = await xo.lintFiles('child/sub-child/four-spaces.ts', {cwd: 'fixtures/typescript', space: 4});
// eslint-disable-next-line ava/assertion-arguments
// eslint-disable-next-line ava/assertion-arguments -- Type issue
t.is(errorCount, 0, JSON.stringify(results[0].messages));
});

test.serial('typescript no semicolon option', async t => {
const {errorCount, results} = await xo.lintFiles('child/no-semicolon.ts', {cwd: 'fixtures/typescript', semicolon: false});
// eslint-disable-next-line ava/assertion-arguments
// eslint-disable-next-line ava/assertion-arguments -- Type issue
t.is(errorCount, 0, JSON.stringify(results[0].messages));
});

Expand All @@ -253,7 +253,7 @@ test('webpack import resolver is used if webpack.config.js is found', async t =>
},
});

// eslint-disable-next-line ava/assertion-arguments
// eslint-disable-next-line ava/assertion-arguments -- Type issue
t.is(results[0].errorCount, 1, JSON.stringify(results[0].messages));

const errorMessage = results[0].messages[0].message;
Expand All @@ -279,7 +279,7 @@ test('webpack import resolver config can be passed through webpack option', asyn
},
});

// eslint-disable-next-line ava/assertion-arguments
// eslint-disable-next-line ava/assertion-arguments -- Type issue
t.is(results[0].errorCount, 1, JSON.stringify(results[0].messages));
});

Expand All @@ -295,7 +295,7 @@ test('webpack import resolver is used if {webpack: true}', async t => {
},
});

// eslint-disable-next-line ava/assertion-arguments
// eslint-disable-next-line ava/assertion-arguments -- Type issue
t.is(results[0].errorCount, 0, JSON.stringify(results[0]));
});

Expand Down
2 changes: 1 addition & 1 deletion test/lint-text.js
Expand Up @@ -346,7 +346,7 @@ test('typescript files: four space pass', async t => {
filePath: fourSpacesFilePath,
space: 4,
});
// eslint-disable-next-line ava/assertion-arguments
// eslint-disable-next-line ava/assertion-arguments -- Type issue
t.is(results[0].errorCount, 0, JSON.stringify(results[0].messages));
});

Expand Down
9 changes: 4 additions & 5 deletions test/open-report.js
@@ -1,4 +1,3 @@
/* eslint-disable ava/no-skip-test */
import process from 'node:process';
import path from 'node:path';
import test from 'ava';
Expand All @@ -9,7 +8,7 @@ import xo from '../index.js';
const {__dirname} = createEsmUtils(import.meta);
process.chdir(__dirname);

test.skip('opens nothing when there are no errors nor warnings', async t => {
test.failing('opens nothing when there are no errors nor warnings', async t => {
const glob = path.join(__dirname, 'fixtures/open-report/successes/*');
const results = await xo.lintFiles(glob);

Expand All @@ -25,7 +24,7 @@ test.skip('opens nothing when there are no errors nor warnings', async t => {
t.pass();
});

test.skip('only opens errors if there are errors and warnings', async t => {
test.failing('only opens errors if there are errors and warnings', async t => {
const glob = path.join(__dirname, 'fixtures/open-report/**');
const results = await xo.lintFiles(glob);

Expand Down Expand Up @@ -55,7 +54,7 @@ test.skip('only opens errors if there are errors and warnings', async t => {
openReport(results);
});

test.skip('if a file has errors and warnings, it opens the first error', async t => {
test.failing('if a file has errors and warnings, it opens the first error', async t => {
const glob = path.join(__dirname, 'fixtures/open-report/errors/two-with-warnings.js');
const results = await xo.lintFiles(glob);

Expand All @@ -73,7 +72,7 @@ test.skip('if a file has errors and warnings, it opens the first error', async t
openReport(results);
});

test.skip('only opens warnings if there are no errors', async t => {
test.failing('only opens warnings if there are no errors', async t => {
const glob = path.join(__dirname, 'fixtures/open-report/warnings/*');
const results = await xo.lintFiles(glob);

Expand Down

0 comments on commit 2452616

Please sign in to comment.