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-case-declarations": "error",
"no-const-assign": "error", "no-const-assign": "error",
"no-constant-condition": "off", "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-vars": ["error", {"vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "caughtErrors": "none"}],
"no-unused-expressions": "error", "no-unused-expressions": "error",
"no-var": "error", "no-var": "error",
@ -32,5 +33,37 @@
"quotes": ["error", "single", "avoid-escape"], "quotes": ["error", "single", "avoid-escape"],
"require-atomic-updates": "off", "require-atomic-updates": "off",
"semi": "error" "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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/*global requestJson*/
/* /*
* AnkiConnect * AnkiConnect

View File

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

View File

@ -16,6 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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 { class Backend {
constructor() { constructor() {

View File

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

View File

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

View File

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

View File

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

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/*global wanakana*/
const JP_HALFWIDTH_KATAKANA_MAPPING = new Map([ 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/*global utilStringHashCode*/
/* /*
* Generic options functions * Generic options functions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,6 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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; let dictionaryUI = null;

View File

@ -16,6 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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) { function getOptionsMutable(optionsContext) {
return utilBackend().getOptions( return utilBackend().getOptions(
utilBackgroundIsolate(optionsContext) utilBackgroundIsolate(optionsContext)

View File

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

View File

@ -16,6 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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 currentProfileIndex = 0;
let profileConditionsContainer = null; let profileConditionsContainer = null;

View File

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

View File

@ -16,6 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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 { class Translator {
constructor() { constructor() {

View File

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

View File

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

View File

@ -16,6 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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 { class Display {
constructor(spinner, container) { constructor(spinner, container) {

View File

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