Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support
--dot
command line option. (#1985)
* feat: Support `--dot` command line option. * Update README.md * Update app.test.ts.snap * dev: Add config `enableGlobDot` * Make linter aware of `enableGlobDot` config option. * test: Increase coverage
- Loading branch information
Showing
22 changed files
with
131 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Nested Hidden file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Hidden MD |
18 changes: 5 additions & 13 deletions
18
...ell/src/CSpellApplicationConfiguration.ts → packages/cspell/src/LinterConfiguration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from '@cspell/cspell-types'; | ||
export * from './application'; | ||
export type { BaseOptions, CSpellApplicationOptions, TraceOptions } from './options'; | ||
export type { BaseOptions, LinterOptions as CSpellApplicationOptions, TraceOptions } from './options'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { runLint } from './lint'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import * as path from 'path'; | ||
import { LinterConfiguration } from '../LinterConfiguration'; | ||
import { InMemoryReporter } from '../util/InMemoryReporter'; | ||
import { runLint } from './lint'; | ||
|
||
const samples = path.resolve(__dirname, '../../samples'); | ||
const latexSamples = path.resolve(samples, 'latex'); | ||
const hiddenSamples = path.resolve(samples, 'hidden-test'); | ||
|
||
const oc = expect.objectContaining; | ||
const j = path.join; | ||
|
||
describe('Linter Validation Tests', () => { | ||
test('globs on the command line override globs in the config.', async () => { | ||
const options = { root: latexSamples }; | ||
const reporter = new InMemoryReporter(); | ||
const rWithoutFiles = await runLint(new LinterConfiguration([], options, reporter)); | ||
expect(rWithoutFiles.files).toBe(4); | ||
const rWithFiles = await runLint(new LinterConfiguration(['**/ebook.tex'], options, reporter)); | ||
expect(rWithFiles.files).toBe(1); | ||
}); | ||
|
||
// cspell:ignore Tufte | ||
test.each` | ||
files | options | expectedRunResult | expectedReport | ||
${[]} | ${{ root: latexSamples }} | ${oc({ errors: 0, files: 4 })} | ${oc({ errorCount: 0, issues: [oc({ text: 'Tufte' })] })} | ||
${['**/ebook.tex']} | ${{ root: latexSamples }} | ${oc({ errors: 0, files: 1 })} | ${oc({ errorCount: 0, issues: [] })} | ||
${['**/ebook.tex']} | ${{ root: latexSamples, gitignore: true }} | ${oc({ errors: 0, files: 1 })} | ${oc({ errorCount: 0, issues: [] })} | ||
${['**/hidden.md']} | ${{ root: hiddenSamples }} | ${oc({ errors: 0, files: 0 })} | ${oc({ errorCount: 0, issues: [] })} | ||
${['**/hidden.md']} | ${{ root: hiddenSamples, dot: true }} | ${oc({ errors: 0, files: 1 })} | ${oc({ errorCount: 0, issues: [] })} | ||
${['**/*.md']} | ${{ root: hiddenSamples, dot: false }} | ${oc({ errors: 0, files: 0 })} | ${oc({ errorCount: 0, issues: [] })} | ||
${['**/*.md']} | ${{ root: hiddenSamples }} | ${oc({ errors: 0, files: 0 })} | ${oc({ errorCount: 0, issues: [] })} | ||
${['**/*.md']} | ${{ root: hiddenSamples, dot: true }} | ${oc({ errors: 0, files: 2 })} | ${oc({ errorCount: 0, issues: [] })} | ||
${['**']} | ${{ root: samples, config: j(samples, 'cspell-not-found.json') }} | ${oc({ errors: 1, files: 0 })} | ${oc({ errorCount: 1, errors: [expect.any(Error)], issues: [] })} | ||
${['**']} | ${{ root: samples, config: j(samples, 'linked/cspell-import-missing.json') }} | ${oc({ errors: 1, files: 0 })} | ${oc({ errorCount: 1, errors: [expect.any(Error)], issues: [] })} | ||
${['**/ebook.tex']} | ${{ root: samples, config: j(samples, 'cspell-missing-dict.json') }} | ${oc({ errors: 0, files: 0 })} | ${oc({ errorCount: 0, errors: [], issues: [] })} | ||
${['**/ebook.tex']} | ${{ root: samples, config: j(samples, 'linked/cspell-import.json') }} | ${oc({ errors: 0, files: 1 })} | ${oc({ errorCount: 0, issues: [] })} | ||
`('runLint $files $options', async ({ files, options, expectedRunResult, expectedReport }) => { | ||
const reporter = new InMemoryReporter(); | ||
const runResult = await runLint(new LinterConfiguration(files, options, reporter)); | ||
expect(runResult).toEqual(expectedRunResult); | ||
expect(runResult).toEqual(reporter.runResult); | ||
expect(report(reporter)).toEqual(expectedReport); | ||
}); | ||
}); | ||
|
||
function report(reporter: InMemoryReporter) { | ||
const { issues, errorCount, errors } = reporter; | ||
return { issues, errorCount, errors }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.