2020-04-26 17:56:44 +00:00
|
|
|
module.exports = {
|
2020-10-01 01:49:59 +00:00
|
|
|
env: {
|
|
|
|
browser: true,
|
|
|
|
es6: true,
|
2020-12-18 02:55:06 +00:00
|
|
|
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: {
|
2020-11-10 21:11:03 +00:00
|
|
|
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: {
|
2020-12-18 02:55:06 +00:00
|
|
|
"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",
|
2020-12-15 16:38:43 +00:00
|
|
|
"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
|
2021-11-01 00:37:00 +00:00
|
|
|
"operator-linebreak": ["error", "before", {
|
|
|
|
overrides: {
|
|
|
|
"=": "after"
|
|
|
|
}
|
2021-01-14 17:32:51 +00:00
|
|
|
}],
|
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"],
|
2021-05-02 01:56:30 +00:00
|
|
|
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-04-26 17:56:44 +00:00
|
|
|
},
|
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",
|
2020-12-18 02:55:06 +00:00
|
|
|
// languages are all over the map and we don't want to
|
|
|
|
// do a mass edit so turn off the most egregious rule violations
|
2020-11-17 05:54:04 +00:00
|
|
|
// indent: "off",
|
2020-12-18 02:55:06 +00:00
|
|
|
camelcase: "off",
|
|
|
|
"no-control-regex": "off",
|
|
|
|
"no-useless-escape": "off",
|
2021-05-02 02:10:22 +00:00
|
|
|
"comma-dangle": "off",
|
2020-11-17 05:54:04 +00:00
|
|
|
"array-bracket-spacing": ["error", "always"
|
2020-12-18 02:55:06 +00:00
|
|
|
// {
|
|
|
|
// objectsInArrays: true
|
2020-11-17 05:54:04 +00:00
|
|
|
// }
|
|
|
|
],
|
2020-12-18 02:55:06 +00:00
|
|
|
// "object-curly-spacing": "warn",
|
2020-11-17 05:54:04 +00:00
|
|
|
// "key-spacing": "off",
|
2020-12-18 02:55:06 +00:00
|
|
|
// "array-bracket-spacing": ["warn"],
|
|
|
|
"array-bracket-newline": ["warn", {
|
2020-11-17 05:54:04 +00:00
|
|
|
multiline: true,
|
|
|
|
minItems: 2
|
|
|
|
}],
|
2020-12-18 02:55:06 +00:00
|
|
|
"array-element-newline": "warn",
|
2020-11-17 05:54:04 +00:00
|
|
|
"object-curly-newline": [1, {
|
2021-05-02 02:53:18 +00:00
|
|
|
minProperties: 2
|
2020-11-17 05:54:04 +00:00
|
|
|
}],
|
|
|
|
"object-property-newline": [2,
|
|
|
|
{ allowAllPropertiesOnSameLine: false }
|
|
|
|
]
|
2020-04-26 17:56:44 +00:00
|
|
|
}
|
2020-12-18 02:55:06 +00:00
|
|
|
},
|
2020-12-18 21:00:29 +00:00
|
|
|
{
|
|
|
|
files: ["demo/**/*.js"],
|
|
|
|
globals: {
|
|
|
|
hljs: "readonly"
|
|
|
|
}
|
|
|
|
},
|
2020-12-18 02:55:06 +00:00
|
|
|
{
|
|
|
|
files: ["test/**/*.js"],
|
2021-02-15 17:25:15 +00:00
|
|
|
globals: {
|
|
|
|
should: "readonly"
|
|
|
|
},
|
2020-12-18 02:55:06 +00:00
|
|
|
env: {
|
|
|
|
mocha: true
|
|
|
|
},
|
|
|
|
parserOptions: {
|
|
|
|
ecmaVersion: 2018
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ["tools/**/*.js"],
|
|
|
|
parserOptions: {
|
|
|
|
ecmaVersion: 2018
|
2021-01-22 15:59:53 +00:00
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
camelcase: "off"
|
2020-12-18 02:55:06 +00:00
|
|
|
}
|
2020-10-01 01:40:26 +00:00
|
|
|
}
|
|
|
|
]
|
2020-04-26 17:56:44 +00:00
|
|
|
};
|