Skip to content

Commit

Permalink
dev: set ESLint rule to be spellchecker. (#2563)
Browse files Browse the repository at this point in the history
* dev: set eslint rule to be `spellchecker`.

* dev: add local prettier config to ESLint plugin test
  • Loading branch information
Jason3S committed Mar 9, 2022
1 parent 8f5f855 commit 813872f
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/cspell-eslint-plugin/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ruleTester = new RuleTester({
],
});

ruleTester.run('cspell', rule.rules.cspell, {
ruleTester.run('cspell', rule.rules.spellchecker, {
valid: [readSample('sample.js'), readSample('sample.ts'), readSample('sampleESM.mjs')],
invalid: [
// cspell:ignore Guuide Gallaxy BADD functionn
Expand Down
4 changes: 2 additions & 2 deletions packages/cspell-eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { format } from 'util';
import { createTextDocument, DocumentValidator, ValidationIssue, CSpellSettings } from 'cspell-lib';

interface PluginRules {
['cspell']: Rule.RuleModule;
['spellchecker']: Rule.RuleModule;
}

const meta: Rule.RuleMetaData = {
Expand Down Expand Up @@ -184,7 +184,7 @@ function tagLiteral(node: ASTNode | TSESTree.Node): string {
}

export const rules: PluginRules = {
cspell: {
spellchecker: {
meta,
create,
},
Expand Down
28 changes: 28 additions & 0 deletions test-packages/test-cspell-eslint-plugin/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.CRLF.txt]
end_of_line = crlf

[*.noEOL.txt]
insert_final_newline = false

[*.{yaml,yml}]
indent_size = 2

[{package*.json,lerna.json}]
indent_size = 2

[*.md]
indent_size = 2
trim_trailing_whitespace = false

[config.json]
indent_size = 2
2 changes: 1 addition & 1 deletion test-packages/test-cspell-eslint-plugin/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const config = {
files: ['**/*.ts', '**/*.js'],
plugins: ['@cspell'],
rules: {
'@cspell/cspell': 'warn',
'@cspell/spellchecker': 'warn',
},
},
],
Expand Down
12 changes: 12 additions & 0 deletions test-packages/test-cspell-eslint-plugin/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 120,
"singleQuote": true,
"overrides": [
{
"files": "**/*.{yaml,yml}",
"options": {
"singleQuote": false
}
}
]
}

0 comments on commit 813872f

Please sign in to comment.