prism/.eslintrc.js

140 lines
2.5 KiB
JavaScript
Raw Normal View History

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
extends: 'eslint:recommended',
rules: {
2021-04-18 04:26:40 +08:00
// stylistic rules
2021-04-18 22:13:48 +08:00
'brace-style': ['warn', '1tbs', { allowSingleLine: true }],
2021-04-18 04:35:25 +08:00
'no-var': 'error',
2021-04-18 04:26:40 +08:00
'quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
2021-04-18 04:30:39 +08:00
'semi': 'warn',
2021-04-18 21:55:05 +08:00
'wrap-iife': 'warn',
2021-04-18 04:26:40 +08:00
// I turned this rule off because we use `hasOwnProperty` in a lot of places
// TODO: Think about re-enabling this rule
'no-prototype-builtins': 'off',
// TODO: Think about re-enabling this rule
'no-cond-assign': 'off',
// TODO: Think about re-enabling this rule
'no-inner-declarations': 'off',
// TODO: Think about re-enabling this rule
'no-sparse-arrays': 'off',
// turning off some regex rules
// these are supposed to protect against accidental use but we need those quite often
'no-control-regex': 'off',
'no-empty-character-class': 'off',
'no-useless-escape': 'off'
},
ignorePatterns: [
'*.min.js',
'vendor/',
'utopia.js',
'docs/',
'components.js',
'prism.js',
'node_modules'
],
overrides: [
{
// Languages and plugins
files: [
'components/*.js',
'plugins/*/prism-*.js'
],
excludedFiles: 'components/index.js',
env: {
browser: true,
node: true,
worker: true
},
globals: {
'Prism': true
2021-04-18 04:35:25 +08:00
},
rules: {
'no-var': 'off'
}
},
{
// `loadLanguages` function for Node.js
files: 'components/index.js',
env: {
es6: true,
node: true
},
parserOptions: {
ecmaVersion: 6
},
globals: {
'Prism': true
}
},
{
// Gulp and Danger
files: 'dependencies.js',
env: {
browser: true,
node: true
2021-04-18 04:35:25 +08:00
},
rules: {
'no-var': 'off'
}
},
{
// The scripts that run on our website
files: 'assets/*.js',
env: {
browser: true
},
globals: {
'components': true,
'getLoader': true,
'PrefixFree': true,
'Prism': true,
'Promise': true,
'saveAs': true,
'$': true,
'$$': true,
'$u': true
2021-04-18 04:35:25 +08:00
},
rules: {
'no-var': 'off'
}
},
{
// Test files
files: 'tests/**',
env: {
es6: true,
mocha: true,
node: true
},
parserOptions: {
ecmaVersion: 2018
}
},
{
// Gulp and Danger
files: [
'gulpfile.js/**',
'dangerfile.js'
],
env: {
es6: true,
node: true
},
parserOptions: {
ecmaVersion: 2018
}
},
{
// This file
files: '.eslintrc.js',
env: {
node: true
}
},
]
};