-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support spell checking more document types (#5741)
- Loading branch information
Showing
32 changed files
with
1,707 additions
and
1,481 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
3 changes: 3 additions & 0 deletions
3
packages/cspell-eslint-plugin/fixtures/json-support/README.md
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,3 @@ | ||
# JSON Support | ||
|
||
This directory contains sample to test JSON support. |
24 changes: 24 additions & 0 deletions
24
packages/cspell-eslint-plugin/fixtures/json-support/eslint.config.mjs
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,24 @@ | ||
// @ts-check | ||
import eslint from '@eslint/js'; | ||
import cspellRecommended from '@cspell/eslint-plugin/recommended'; | ||
import eslintPluginJsonc from 'eslint-plugin-jsonc'; | ||
|
||
/** | ||
* @type { import("eslint").Linter.FlatConfig[] } | ||
*/ | ||
const config = [ | ||
eslint.configs.recommended, | ||
cspellRecommended, | ||
...eslintPluginJsonc.configs['flat/recommended-with-jsonc'], | ||
{ | ||
ignores: ['eslint.config.mjs'], | ||
}, | ||
{ | ||
files: ['**/*.json', '**/*.jsonc'], | ||
rules: { | ||
'@cspell/spellchecker': ['warn', { debugMode: true }], | ||
}, | ||
}, | ||
]; | ||
|
||
export default config; |
16 changes: 16 additions & 0 deletions
16
packages/cspell-eslint-plugin/fixtures/json-support/package.json
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,16 @@ | ||
{ | ||
"name": "markdown-support", | ||
"version": "1.0.0", | ||
"description": "", | ||
"scripts": { | ||
"test": "eslint ." | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@cspell/eslint-plugin": "workspace:*", | ||
"eslint-plugin-mdx": "^3.1.5", | ||
"eslint": "^8.50.0" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/cspell-eslint-plugin/fixtures/json-support/sample.jsonc
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,17 @@ | ||
{ | ||
"address": { | ||
"street": "123 Main St", | ||
"city": "Metropolis", | ||
"state": "AA", | ||
"zip": "12345" | ||
}, | ||
"phone": "123-456-7890", | ||
// This is a line commment | ||
"email": "[email protected]", | ||
|
||
"places": ["Home", "Work", "Vacation", "Schooll", "Park", "Library", "Store"] | ||
|
||
/* | ||
This is a block comment | ||
*/ | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/cspell-eslint-plugin/fixtures/mdx-support/README.md
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,12 @@ | ||
# Markdown Support | ||
|
||
**NOTE:** Markdown is not yet supported. See [#3464](https://github.com/streetsidesoftware/cspell/issues/3464) | ||
|
||
This is a sample file to test out support for spell checking Markdown files. | ||
|
||
## Table | ||
|
||
| col 1 | col 2 | col 3 | | ||
| ----- | ----- | ------ | | ||
| a | 22 | b | | ||
| b | 42 | `null` | |
23 changes: 23 additions & 0 deletions
23
packages/cspell-eslint-plugin/fixtures/mdx-support/eslint.config.mjs
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,23 @@ | ||
import eslint from '@eslint/js'; | ||
import cspellRecommended from '@cspell/eslint-plugin/recommended'; | ||
import * as mdx from 'eslint-plugin-mdx'; | ||
|
||
/** | ||
* @type { import("eslint").Linter.FlatConfig[] } | ||
*/ | ||
const config = [ | ||
eslint.configs.recommended, | ||
cspellRecommended, | ||
mdx.configs.flat, | ||
{ | ||
ignores: ['eslint.config.mjs'], | ||
}, | ||
{ | ||
files: ['**/*.mdx', '**/*.md'], | ||
rules: { | ||
'@cspell/spellchecker': ['warn', { debugMode: true }], | ||
}, | ||
}, | ||
]; | ||
|
||
export default config; |
12 changes: 12 additions & 0 deletions
12
packages/cspell-eslint-plugin/fixtures/mdx-support/md-with-code.mdx
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,12 @@ | ||
# Markdown Support with Code | ||
|
||
This is a sample file to test out support for spell checking Markdown files. | ||
|
||
```js | ||
/* Example Function */ | ||
function sampleFn() {} | ||
``` | ||
|
||
```ts | ||
const msg = 'A bit of typescript.'; | ||
``` |
16 changes: 16 additions & 0 deletions
16
packages/cspell-eslint-plugin/fixtures/mdx-support/package.json
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,16 @@ | ||
{ | ||
"name": "markdown-support", | ||
"version": "1.0.0", | ||
"description": "", | ||
"scripts": { | ||
"test": "eslint ." | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@cspell/eslint-plugin": "workspace:*", | ||
"eslint-plugin-mdx": "^3.1.5", | ||
"eslint": "^8.50.0" | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
packages/cspell-eslint-plugin/fixtures/yaml-support/eslint.config.mjs
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,27 @@ | ||
import eslint from '@eslint/js'; | ||
import cspellRecommended from '@cspell/eslint-plugin/recommended'; | ||
import parserYml from 'yaml-eslint-parser'; | ||
import pluginYml from 'eslint-plugin-yml'; | ||
|
||
/** | ||
* @type { import("eslint").Linter.FlatConfig[] } | ||
*/ | ||
const config = [ | ||
eslint.configs.recommended, | ||
cspellRecommended, | ||
...pluginYml.configs['flat/standard'], | ||
{ | ||
files: ['**/*.yaml', '**/*.yml'], | ||
languageOptions: { | ||
parser: parserYml, | ||
}, | ||
// plugins: { | ||
// yml: pluginYml, | ||
// }, | ||
rules: { | ||
'@cspell/spellchecker': 'warn', | ||
}, | ||
}, | ||
]; | ||
|
||
export default config; |
24 changes: 24 additions & 0 deletions
24
packages/cspell-eslint-plugin/fixtures/yaml-support/sample.yaml
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,24 @@ | ||
--- | ||
# Starting comment | ||
list: | ||
- one | ||
- two | ||
- three | ||
- 4 | ||
- 5 | ||
- true | ||
- false | ||
obj: | ||
key: value | ||
key2: value2 # comment after value | ||
key3: value3 | ||
command: | | ||
echo "Hello, World!" | ||
echo "Goodbye, World!" | ||
command2: >- | ||
line 1 | ||
line 2 | ||
'command three': > | ||
line 3 | ||
line 4 | ||
# comment |
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
Oops, something went wrong.