highlight.js/.eslintrc.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

121 lines
3.0 KiB
JavaScript
Raw Permalink Normal View History

module.exports = {
2020-10-01 01:49:59 +00:00
env: {
browser: true,
es6: true,
node: true
2020-10-01 01:40:26 +00:00
},
2020-10-01 01:49:59 +00:00
extends: [
2020-10-01 01:40:26 +00:00
"eslint:recommended",
"standard"
],
2020-10-01 01:49:59 +00:00
parserOptions: {
ecmaVersion: 2015,
2020-10-01 01:49:59 +00:00
sourceType: "module"
2020-10-01 01:40:26 +00:00
},
2020-10-01 01:49:59 +00:00
plugins: [
2020-10-01 01:40:26 +00:00
"@typescript-eslint"
],
2020-10-01 01:49:59 +00:00
rules: {
"no-var": "warn",
2020-10-01 01:49:59 +00:00
"init-declarations": ["error", "always"],
2020-10-01 01:40:26 +00:00
"array-callback-return": "error",
"block-scoped-var": "error",
"no-multiple-empty-lines": ["error", { max: 2 }],
2020-10-01 01:40:26 +00:00
// we like our semi-colons
2020-10-01 01:49:59 +00:00
semi: ["error", "always"],
2020-10-01 01:40:26 +00:00
// our codebase doesn't do this at all, so disabled for now
"space-before-function-paren": ["error", "never"],
// for now ignore diff between types of quoting
2020-10-01 01:49:59 +00:00
quotes: "off",
2020-10-01 01:40:26 +00:00
// this is the style we are already using
"operator-linebreak": ["error", "before", {
overrides: {
"=": "after"
}
}],
2020-10-01 01:40:26 +00:00
// sometimes we declare variables with extra spacing
2020-10-01 01:49:59 +00:00
indent: ["error", 2, { VariableDeclarator: 2 }],
2020-10-01 01:40:26 +00:00
// seems like a good idea not to use explicit undefined
"no-undefined": "error",
// ensure import specifier contains file extension
2020-10-01 01:49:59 +00:00
"import/extensions": ["error", "always"]
2020-10-01 01:40:26 +00:00
},
2020-10-01 01:49:59 +00:00
overrides: [
2021-04-13 00:27:33 +00:00
{
files: ["types/*.ts", "src/*.ts"],
parser: '@typescript-eslint/parser',
rules: {
"import/no-duplicates": "off",
"import/extensions": "off"
}
2021-04-13 00:27:33 +00:00
},
2020-10-01 01:40:26 +00:00
{
2020-10-01 01:49:59 +00:00
files: ["src/**/*.js"],
rules: {
2020-10-01 01:40:26 +00:00
// make sure there is no Node.js specific API slipping into the source files
"import/no-nodejs-modules": "error",
"import/no-commonjs": "error"
}
},
2020-10-01 01:40:26 +00:00
{
2020-10-01 01:49:59 +00:00
files: ["src/languages/*.js"],
rules: {
2020-10-01 01:40:26 +00:00
"no-unused-expressions": "off",
// languages are all over the map and we don't want to
// do a mass edit so turn off the most egregious rule violations
// indent: "off",
camelcase: "off",
"no-control-regex": "off",
"no-useless-escape": "off",
"comma-dangle": "off",
"array-bracket-spacing": ["error", "always"
// {
// objectsInArrays: true
// }
],
// "object-curly-spacing": "warn",
// "key-spacing": "off",
// "array-bracket-spacing": ["warn"],
"array-bracket-newline": ["warn", {
multiline: true,
minItems: 2
}],
"array-element-newline": "warn",
"object-curly-newline": [1, {
minProperties: 2
}],
"object-property-newline": [2,
{ allowAllPropertiesOnSameLine: false }
]
}
},
{
files: ["demo/**/*.js"],
globals: {
hljs: "readonly"
}
},
{
files: ["test/**/*.js"],
globals: {
should: "readonly"
},
env: {
mocha: true
},
parserOptions: {
ecmaVersion: 2018
}
},
{
files: ["tools/**/*.js"],
parserOptions: {
ecmaVersion: 2018
2021-01-22 15:59:53 +00:00
},
rules: {
camelcase: "off"
}
2020-10-01 01:40:26 +00:00
}
]
};