Change no-undef from off to error

This commit is contained in:
toasted-nutbread 2020-02-01 15:00:34 -05:00
parent cb6e8d07d0
commit 4629fb3639
29 changed files with 103 additions and 2 deletions

View File

@ -23,7 +23,8 @@
"no-case-declarations": "error",
"no-const-assign": "error",
"no-constant-condition": "off",
"no-undef": "off",
"no-global-assign": "error",
"no-undef": "error",
"no-unused-vars": ["error", {"vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "caughtErrors": "none"}],
"no-unused-expressions": "error",
"no-var": "error",
@ -32,5 +33,37 @@
"quotes": ["error", "single", "avoid-escape"],
"require-atomic-updates": "off",
"semi": "error"
},
"overrides": [
{
"files": ["*.js"],
"excludedFiles": ["ext/mixed/js/core.js"],
"globals": {
"yomichan": "readonly",
"errorToJson": "readonly",
"jsonToError": "readonly",
"logError": "readonly",
"isObject": "readonly",
"hasOwn": "readonly",
"toIterable": "readonly",
"stringReverse": "readonly",
"promiseTimeout": "readonly",
"stringReplaceAsync": "readonly",
"EventDispatcher": "readonly",
"EXTENSION_IS_BROWSER_EDGE": "readonly"
}
},
{
"files": ["ext/mixed/js/core.js"],
"globals": {
"chrome": "writable"
}
},
{
"files": ["ext/bg/js/settings/*.js"],
"env": {
"jquery": true
}
}
]
}

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global requestJson*/
/*
* AnkiConnect

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global jpIsStringEntirelyKana, audioGetFromSources*/
const audioUrlBuilders = new Map([
['jpod101', async (definition) => {

View File

@ -16,6 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global optionsSave, utilIsolate
conditionsTestValue, profileConditionsDescriptor, profileOptionsGetDefaultFieldTemplates
handlebarsRenderDynamic, handlebarsRenderStatic
requestText, requestJson, optionsLoad
dictConfigured, dictTermsSort, dictEnabledSet, dictNoteFormat
audioGetUrl, audioInject
jpConvertReading, jpDistributeFuriganaInflected, jpKatakanaToHiragana
Translator, AnkiConnect, AnkiNull, Mecab, BackendApiForwarder, JsonSchema*/
class Backend {
constructor() {

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global apiCommandExec, apiGetEnvironmentInfo, apiOptionsGet*/
function showExtensionInfo() {
const node = document.getElementById('extension-info');

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global dictFieldSplit, dictTagSanitize, JSZip*/
class Database {
constructor() {

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global utilSetEqual, utilSetIntersection, apiTemplateRender*/
function dictEnabledSet(options) {
const dictionaries = {};

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global jpIsCharCodeKanji, jpDistributeFurigana, Handlebars*/
function handlebarsEscape(text) {
return Handlebars.Utils.escapeExpression(text);

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global wanakana*/
const JP_HALFWIDTH_KATAKANA_MAPPING = new Map([
['ヲ', 'ヲヺ-'],

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global utilStringHashCode*/
/*
* Generic options functions

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global apiOptionsGet*/
async function searchFrontendSetup() {
const optionsContext = {

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global apiTermsFind, apiOptionsSet, apiTextParse, apiTextParseMecab, apiTemplateRender, TextScanner*/
class QueryParser extends TextScanner {
constructor(search) {

View File

@ -16,6 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global jpIsStringPartiallyJapanese, apiOptionsSet, apiTermsFind, apiClipboardGet, apiGetEnvironmentInfo
Display, QueryParser*/
class DisplaySearch extends Display {
constructor() {
super(document.querySelector('#spinner'), document.querySelector('#content'));

View File

@ -16,6 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global getOptionsContext, getOptionsMutable, settingsSaveOptions
profileOptionsGetDefaultFieldTemplates, ankiGetFieldMarkers, ankiGetFieldMarkersHtml, dictFieldFormat
apiOptionsGet, apiTermsFind*/
function onAnkiFieldTemplatesReset(e) {
e.preventDefault();

View File

@ -16,6 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global getOptionsContext, getOptionsMutable, settingsSaveOptions
utilBackgroundIsolate, utilAnkiGetDeckNames, utilAnkiGetModelNames, utilAnkiGetModelFieldNames
onFormOptionsChanged*/
// Private

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global toIterable*/
class AudioSourceUI {
static instantiateTemplate(templateSelector) {

View File

@ -16,6 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global getOptionsContext, getOptionsMutable, settingsSaveOptions
AudioSourceUI, audioGetTextToSpeechVoice*/
let audioSourceUI = null;

View File

@ -16,6 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global apiOptionsGetFull, apiGetEnvironmentInfo
utilBackend, utilIsolate, utilBackgroundIsolate, utilReadFileArrayBuffer
optionsGetDefault, optionsUpdateVersion
profileOptionsGetDefaultFieldTemplates*/
// Exporting

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global conditionsNormalizeOptionValue*/
class ConditionsUI {
static instantiateTemplate(templateSelector) {

View File

@ -16,6 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global getOptionsContext, getOptionsMutable, getOptionsFullMutable, settingsSaveOptions, apiOptionsGetFull
utilBackgroundIsolate, utilDatabaseDeleteDictionary, utilDatabaseGetDictionaryInfo, utilDatabaseGetDictionaryCounts
utilDatabasePurge, utilDatabaseImport
storageUpdateStats, storageEstimate
PageExitPrevention*/
let dictionaryUI = null;

View File

@ -16,6 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global getOptionsContext, apiOptionsSave
utilBackend, utilIsolate, utilBackgroundIsolate
ankiErrorShown, ankiFieldsToDict
ankiTemplatesUpdateValue, onAnkiOptionsChanged, onDictionaryOptionsChanged
appearanceInitialize, audioSettingsInitialize, profileOptionsSetup, dictSettingsInitialize
ankiInitialize, ankiTemplatesInitialize, storageInfoInitialize
*/
function getOptionsMutable(optionsContext) {
return utilBackend().getOptions(
utilBackgroundIsolate(optionsContext)

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global apiOptionsGet, Popup, PopupProxyHost, Frontend, TextSourceRange*/
class SettingsPopupPreview {
constructor() {

View File

@ -16,6 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global getOptionsMutable, getOptionsFullMutable, settingsSaveOptions, apiOptionsGetFull
utilBackgroundIsolate, formWrite
conditionsClearCaches, ConditionsUI, profileConditionsDescriptor*/
let currentProfileIndex = 0;
let profileConditionsContainer = null;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global apiGetEnvironmentInfo*/
function storageBytesToLabeledString(size) {
const base = 1000;

View File

@ -16,6 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global requestJson
dictTermsMergeBySequence, dictTagBuildSource, dictTermsMergeByGloss, dictTermsSort, dictTagsSort
dictEnabledSet, dictTermsGroup, dictTermsCompressTags, dictTermsUndupe, dictTagSanitize
jpDistributeFurigana, jpConvertHalfWidthKanaToFullWidth, jpConvertNumericTofullWidth
jpConvertAlphabeticToKana, jpHiraganaToKatakana, jpKatakanaToHiragana, jpIsCharCodeJapanese
Database, Deinflector*/
class Translator {
constructor() {

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global apiAudioGetUrl*/
class TextToSpeechAudio {
constructor(text, voice) {

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*global apiGetDisplayTemplatesHtml*/
class DisplayGenerator {
constructor() {

View File

@ -16,6 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global docRangeFromPoint, docSentenceExtract
apiKanjiFind, apiTermsFind, apiNoteView, apiOptionsGet, apiDefinitionsAddable, apiDefinitionAdd
apiScreenshotGet, apiForward
audioPrepareTextToSpeech, audioGetFromSources
DisplayGenerator, WindowScroll, DisplayContext, DOM*/
class Display {
constructor(spinner, container) {

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*global docRangeFromPoint, TextSourceRange, DOM*/
class TextScanner {
constructor(node, ignoreNodes, ignoreElements, ignorePoints) {