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

View File

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

View File

@ -27,7 +27,7 @@ for (const lang in languages) {
if (languages[lang].aliasTitles) { if (languages[lang].aliasTitles) {
it('- should have all alias titles registered as alias', function () { 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 => { Object.keys(languages[lang].aliasTitles).forEach(id => {
if (!aliases.has(id)) { if (!aliases.has(id)) {
@ -40,7 +40,7 @@ for (const lang in languages) {
it('- should known all aliases', function () { 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 // check that all aliases are defined
toArray(languages[lang].alias).forEach(alias => { toArray(languages[lang].alias).forEach(alias => {

View File

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