Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(next-lint): update option --report-unused-disable-directives to --report-unused-disable-directives-severity #64405

Merged
merged 6 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion packages/next/src/bin/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ program
'Prevents comments from changing config or rules.'
)
.option(
'--report-unused-disable-directives',
samcx marked this conversation as resolved.
Show resolved Hide resolved
'--report-unused-disable-directives <type>',
'Adds reported errors for unused eslint-disable directives.'
)
.option('--no-cache', 'Disables caching.')
Expand Down
46 changes: 37 additions & 9 deletions test/integration/eslint/test/next-lint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import os from 'os'
import { join } from 'path'

import findUp from 'next/dist/compiled/find-up'
import { File, nextBuild, nextLint } from 'next-test-utils'
import { nextLint } from 'next-test-utils'

const dirFirstTimeSetup = join(__dirname, '../first-time-setup')
const dirCustomConfig = join(__dirname, '../custom-config')
Expand All @@ -21,17 +21,9 @@ const dirIgnoreDuringBuilds = join(__dirname, '../ignore-during-builds')
const dirBaseDirectories = join(__dirname, '../base-directories')
const dirCustomDirectories = join(__dirname, '../custom-directories')
const dirConfigInPackageJson = join(__dirname, '../config-in-package-json')
const dirInvalidOlderEslintVersion = join(
__dirname,
'../invalid-eslint-version'
)
const dirMaxWarnings = join(__dirname, '../max-warnings')
const dirEmptyDirectory = join(__dirname, '../empty-directory')
const dirEslintIgnore = join(__dirname, '../eslint-ignore')
const dirNoEslintPlugin = join(__dirname, '../no-eslint-plugin')
const dirNoConfig = join(__dirname, '../no-config')
const dirEslintCache = join(__dirname, '../eslint-cache')
const dirEslintCacheCustomDir = join(__dirname, '../eslint-cache-custom-dir')
const dirFileLinting = join(__dirname, '../file-linting')
const mjsCjsLinting = join(__dirname, '../mjs-cjs-linting')
const dirTypescript = join(__dirname, '../with-typescript')
Expand Down Expand Up @@ -211,6 +203,42 @@ describe('Next Lint', () => {
)
})

test.only('verify options name and type with auto-generated help output', async () => {
samcx marked this conversation as resolved.
Show resolved Hide resolved
const options = [
'-d, --dir, <dirs...>',
'--file, <files...>',
'--ext, [exts...]',
'-c, --config, <config>',
'--resolve-plugins-relative-to, <rprt>',
'--strict',
'--rulesdir, <rulesdir...>',
'--fix',
'--fix-type <fixType>',
'--ignore-path <path>',
'--no-ignore',
'--quiet',
'--max-warnings [maxWarnings]',
'-o, --output-file, <outputFile>',
'-f, --format, <format>',
'--no-inline-config',
'--report-unused-disable-directives',
'--no-cache',
'--cache-location, <cacheLocation>',
'--cache-strategy, [cacheStrategy]',
'--error-on-unmatched-pattern',
]
const { stdout, stderr } = await nextLint(dirNoConfig, ['-h'], {
stdout: true,
stderr: true,
})

const output = stdout + stderr

for (let option of options) {
expect(output).toContain(option)
}
})

test('base directories are linted by default', async () => {
const { stdout, stderr } = await nextLint(dirBaseDirectories, [], {
stdout: true,
Expand Down
Loading