ESLint: Added no-var rule (#2837)

This commit is contained in:
Michael Schmidt 2021-04-17 22:35:25 +02:00 committed by GitHub
parent b03e7eb0cd
commit f46938e9ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 5 deletions

View File

@ -4,6 +4,7 @@ module.exports = {
extends: 'eslint:recommended',
rules: {
// stylistic rules
'no-var': 'error',
'quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'semi': 'warn',
@ -48,6 +49,9 @@ module.exports = {
},
globals: {
'Prism': true
},
rules: {
'no-var': 'off'
}
},
{
@ -70,6 +74,9 @@ module.exports = {
env: {
browser: true,
node: true
},
rules: {
'no-var': 'off'
}
},
{
@ -88,6 +95,9 @@ module.exports = {
'$': true,
'$$': true,
'$u': true
},
rules: {
'no-var': 'off'
}
},
{

View File

@ -25,8 +25,8 @@ function docsClean() {
}
function docsCreate(cb) {
var config = require(jsDoc.config);
var files = [jsDoc.readme].concat(jsDoc.files);
let config = require(jsDoc.config);
let files = [jsDoc.readme].concat(jsDoc.files);
src(files, { read: false }).pipe(jsdoc(config, cb));
}

View File

@ -27,7 +27,7 @@ for (const lang in languages) {
if (languages[lang].aliasTitles) {
it('- should have all alias titles registered as alias', function () {
var aliases = new Set(toArray(languages[lang].alias));
let aliases = new Set(toArray(languages[lang].alias));
Object.keys(languages[lang].aliasTitles).forEach(id => {
if (!aliases.has(id)) {
@ -40,7 +40,7 @@ for (const lang in languages) {
it('- should known all aliases', function () {
var loadedLanguages = new Set(Object.keys(PrismLoader.createInstance(lang).languages));
let loadedLanguages = new Set(Object.keys(PrismLoader.createInstance(lang).languages));
// check that all aliases are defined
toArray(languages[lang].alias).forEach(alias => {

View File

@ -199,7 +199,7 @@ module.exports = (Prism) => {
root = root || Prism.languages;
var grammar = root[inside];
let grammar = root[inside];
if (typeof grammar !== 'object') {
throw new Error(`The grammar "${inside}" has to be an 'object' not '${typeof grammar}'.`);