eslint-plugin-spellcheck
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -13,2 +13,3 @@ (function(){ | ||
identifiers: true, | ||
lang: 'en_US', | ||
skipWords: [ | ||
@@ -15,0 +16,0 @@ 'dict', |
{ | ||
"name": "eslint-plugin-spellcheck", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "ESLint rules to spell check js files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,6 +5,3 @@ var lodash = require('lodash'), | ||
spell = new Spellchecker(), | ||
dictionary = spell.parse({ | ||
aff: fs.readFileSync(__dirname + '/utils/dicts/en_US.aff'), | ||
dic: fs.readFileSync(__dirname + '/utils/dicts/en_US.dic') | ||
}), | ||
dictionary, | ||
globals = require('globals'), | ||
@@ -21,4 +18,2 @@ skipWords = lodash.union( | ||
spell.use(dictionary); | ||
module.exports = function(context) { | ||
@@ -34,3 +29,12 @@ 'use strict'; | ||
}, | ||
options = lodash.assign(defaultOptions, context.options[0]); | ||
options = lodash.assign(defaultOptions, context.options[0]), | ||
lang = options.lang || 'en_US'; | ||
dictionary = spell.parse({ | ||
aff: fs.readFileSync(__dirname + '/utils/dicts/' + lang + '.aff'), | ||
dic: fs.readFileSync(__dirname + '/utils/dicts/' + lang + '.dic') | ||
}); | ||
spell.use(dictionary); | ||
options.skipWords = lodash.union(options.skipWords, skipWords) | ||
@@ -37,0 +41,0 @@ .map(function (string) { |
@@ -81,2 +81,15 @@ //------------------------------------------------------------------------------ | ||
{ message: 'You have a misspelled word: srting on String'}] | ||
}, | ||
{ | ||
code: 'var a = 1 // colour cheque behaviour tsih', | ||
args:[2, {lang: 'en_GB', skipWords: ['dict']}], | ||
errors: [ | ||
{ message: 'You have a misspelled word: tsih on Comment'}] | ||
}, | ||
{ | ||
code: 'var a = 1 // color is a comment behavior dict', | ||
args:[2, {lang: 'en_GB', skipWords: ['dict']}], | ||
errors: [ | ||
{ message: 'You have a misspelled word: color on Comment'}, | ||
{ message: 'You have a misspelled word: behavior on Comment'}] | ||
} | ||
@@ -83,0 +96,0 @@ |
1319188
13
242