mirror of https://github.com/zulip/zulip.git
eslint: Migrate JSON config to JavaScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
fa91a4493c
commit
ebc39137e2
|
@ -1,61 +1,63 @@
|
||||||
{
|
"use strict";
|
||||||
"root": true,
|
|
||||||
"env": {
|
module.exports = {
|
||||||
"es2020": true,
|
root: true,
|
||||||
"node": true
|
env: {
|
||||||
|
es2020: true,
|
||||||
|
node: true,
|
||||||
},
|
},
|
||||||
"extends": [
|
extends: [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"plugin:import/errors",
|
"plugin:import/errors",
|
||||||
"plugin:import/warnings",
|
"plugin:import/warnings",
|
||||||
"plugin:no-jquery/recommended",
|
"plugin:no-jquery/recommended",
|
||||||
"plugin:no-jquery/deprecated",
|
"plugin:no-jquery/deprecated",
|
||||||
"plugin:unicorn/recommended",
|
"plugin:unicorn/recommended",
|
||||||
"prettier"
|
"prettier",
|
||||||
],
|
],
|
||||||
"parser": "@babel/eslint-parser",
|
parser: "@babel/eslint-parser",
|
||||||
"parserOptions": {
|
parserOptions: {
|
||||||
"requireConfigFile": false,
|
requireConfigFile: false,
|
||||||
"warnOnUnsupportedTypeScriptVersion": false,
|
warnOnUnsupportedTypeScriptVersion: false,
|
||||||
"sourceType": "unambiguous"
|
sourceType: "unambiguous",
|
||||||
},
|
},
|
||||||
"plugins": ["formatjs", "no-jquery"],
|
plugins: ["formatjs", "no-jquery"],
|
||||||
"settings": {
|
settings: {
|
||||||
"formatjs": {
|
formatjs: {
|
||||||
"additionalFunctionNames": ["$t", "$t_html"]
|
additionalFunctionNames: ["$t", "$t_html"],
|
||||||
},
|
},
|
||||||
"no-jquery": {
|
"no-jquery": {
|
||||||
"collectionReturningPlugins": {
|
collectionReturningPlugins: {
|
||||||
"expectOne": "always"
|
expectOne: "always",
|
||||||
},
|
},
|
||||||
"variablePattern": "^\\$(?!t$|t_html$)."
|
variablePattern: "^\\$(?!t$|t_html$).",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
"reportUnusedDisableDirectives": true,
|
reportUnusedDisableDirectives: true,
|
||||||
"rules": {
|
rules: {
|
||||||
"array-callback-return": "error",
|
"array-callback-return": "error",
|
||||||
"arrow-body-style": "error",
|
"arrow-body-style": "error",
|
||||||
"block-scoped-var": "error",
|
"block-scoped-var": "error",
|
||||||
"consistent-return": "error",
|
"consistent-return": "error",
|
||||||
"curly": "error",
|
curly: "error",
|
||||||
"dot-notation": "error",
|
"dot-notation": "error",
|
||||||
"eqeqeq": "error",
|
eqeqeq: "error",
|
||||||
"formatjs/enforce-default-message": ["error", "literal"],
|
"formatjs/enforce-default-message": ["error", "literal"],
|
||||||
"formatjs/enforce-placeholders": [
|
"formatjs/enforce-placeholders": [
|
||||||
"error",
|
"error",
|
||||||
{"ignoreList": ["b", "code", "em", "i", "kbd", "p", "strong"]}
|
{ignoreList: ["b", "code", "em", "i", "kbd", "p", "strong"]},
|
||||||
],
|
],
|
||||||
"formatjs/no-id": "error",
|
"formatjs/no-id": "error",
|
||||||
"guard-for-in": "error",
|
"guard-for-in": "error",
|
||||||
"import/extensions": "error",
|
"import/extensions": "error",
|
||||||
"import/first": "error",
|
"import/first": "error",
|
||||||
"import/newline-after-import": "error",
|
"import/newline-after-import": "error",
|
||||||
"import/no-cycle": ["error", {"ignoreExternal": true}],
|
"import/no-cycle": ["error", {ignoreExternal: true}],
|
||||||
"import/no-duplicates": "error",
|
"import/no-duplicates": "error",
|
||||||
"import/no-self-import": "error",
|
"import/no-self-import": "error",
|
||||||
"import/no-unresolved": "off",
|
"import/no-unresolved": "off",
|
||||||
"import/no-useless-path-segments": "error",
|
"import/no-useless-path-segments": "error",
|
||||||
"import/order": ["error", {"alphabetize": {"order": "asc"}, "newlines-between": "always"}],
|
"import/order": ["error", {alphabetize: {order: "asc"}, "newlines-between": "always"}],
|
||||||
"import/unambiguous": "error",
|
"import/unambiguous": "error",
|
||||||
"lines-around-directive": "error",
|
"lines-around-directive": "error",
|
||||||
"new-cap": "error",
|
"new-cap": "error",
|
||||||
|
@ -64,7 +66,7 @@
|
||||||
"no-bitwise": "error",
|
"no-bitwise": "error",
|
||||||
"no-caller": "error",
|
"no-caller": "error",
|
||||||
"no-catch-shadow": "error",
|
"no-catch-shadow": "error",
|
||||||
"no-constant-condition": ["error", {"checkLoops": false}],
|
"no-constant-condition": ["error", {checkLoops: false}],
|
||||||
"no-div-regex": "error",
|
"no-div-regex": "error",
|
||||||
"no-else-return": "error",
|
"no-else-return": "error",
|
||||||
"no-eq-null": "error",
|
"no-eq-null": "error",
|
||||||
|
@ -93,24 +95,24 @@
|
||||||
"no-sync": "error",
|
"no-sync": "error",
|
||||||
"no-throw-literal": "error",
|
"no-throw-literal": "error",
|
||||||
"no-undef-init": "error",
|
"no-undef-init": "error",
|
||||||
"no-unneeded-ternary": ["error", {"defaultAssignment": false}],
|
"no-unneeded-ternary": ["error", {defaultAssignment: false}],
|
||||||
"no-unused-expressions": "error",
|
"no-unused-expressions": "error",
|
||||||
"no-unused-vars": [
|
"no-unused-vars": [
|
||||||
"error",
|
"error",
|
||||||
{"args": "all", "argsIgnorePattern": "^_", "ignoreRestSiblings": true}
|
{args: "all", argsIgnorePattern: "^_", ignoreRestSiblings: true},
|
||||||
],
|
],
|
||||||
"no-use-before-define": ["error", {"functions": false}],
|
"no-use-before-define": ["error", {functions: false}],
|
||||||
"no-useless-concat": "error",
|
"no-useless-concat": "error",
|
||||||
"no-useless-constructor": "error",
|
"no-useless-constructor": "error",
|
||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
"object-shorthand": ["error", "always", {"avoidExplicitReturnArrows": true}],
|
"object-shorthand": ["error", "always", {avoidExplicitReturnArrows: true}],
|
||||||
"one-var": ["error", "never"],
|
"one-var": ["error", "never"],
|
||||||
"prefer-arrow-callback": "error",
|
"prefer-arrow-callback": "error",
|
||||||
"prefer-const": ["error", {"ignoreReadBeforeAssign": true}],
|
"prefer-const": ["error", {ignoreReadBeforeAssign: true}],
|
||||||
"radix": "error",
|
radix: "error",
|
||||||
"sort-imports": ["error", {"ignoreDeclarationSort": true}],
|
"sort-imports": ["error", {ignoreDeclarationSort: true}],
|
||||||
"spaced-comment": ["error", "always", {"markers": ["/"]}],
|
"spaced-comment": ["error", "always", {markers: ["/"]}],
|
||||||
"strict": "error",
|
strict: "error",
|
||||||
"unicorn/consistent-function-scoping": "off",
|
"unicorn/consistent-function-scoping": "off",
|
||||||
"unicorn/explicit-length-check": "off",
|
"unicorn/explicit-length-check": "off",
|
||||||
"unicorn/filename-case": "off",
|
"unicorn/filename-case": "off",
|
||||||
|
@ -127,61 +129,61 @@
|
||||||
"unicorn/prefer-top-level-await": "off",
|
"unicorn/prefer-top-level-await": "off",
|
||||||
"unicorn/prevent-abbreviations": "off",
|
"unicorn/prevent-abbreviations": "off",
|
||||||
"unicorn/switch-case-braces": "off",
|
"unicorn/switch-case-braces": "off",
|
||||||
"valid-typeof": ["error", {"requireStringLiterals": true}],
|
"valid-typeof": ["error", {requireStringLiterals: true}],
|
||||||
"yoda": "error"
|
yoda: "error",
|
||||||
},
|
},
|
||||||
"overrides": [
|
overrides: [
|
||||||
{
|
{
|
||||||
"files": ["web/tests/**"],
|
files: ["web/tests/**"],
|
||||||
"rules": {
|
rules: {
|
||||||
"no-jquery/no-selector-prop": "off"
|
"no-jquery/no-selector-prop": "off",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["web/e2e-tests/**"],
|
files: ["web/e2e-tests/**"],
|
||||||
"globals": {
|
globals: {
|
||||||
"zulip_test": false
|
zulip_test: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["web/src/**"],
|
files: ["web/src/**"],
|
||||||
"globals": {
|
globals: {
|
||||||
"StripeCheckout": false
|
StripeCheckout: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["**/*.ts"],
|
files: ["**/*.ts"],
|
||||||
"extends": [
|
extends: [
|
||||||
"plugin:@typescript-eslint/strict-type-checked",
|
"plugin:@typescript-eslint/strict-type-checked",
|
||||||
"plugin:@typescript-eslint/stylistic-type-checked",
|
"plugin:@typescript-eslint/stylistic-type-checked",
|
||||||
"plugin:import/typescript"
|
"plugin:import/typescript",
|
||||||
],
|
],
|
||||||
"parserOptions": {
|
parserOptions: {
|
||||||
"project": "tsconfig.json"
|
project: "tsconfig.json",
|
||||||
},
|
},
|
||||||
"settings": {
|
settings: {
|
||||||
"import/resolver": {
|
"import/resolver": {
|
||||||
"node": {
|
node: {
|
||||||
"extensions": [".ts", ".d.ts", ".js"] // https://github.com/import-js/eslint-plugin-import/issues/2267
|
extensions: [".ts", ".d.ts", ".js"], // https://github.com/import-js/eslint-plugin-import/issues/2267
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
"globals": {
|
globals: {
|
||||||
"JQuery": false
|
JQuery: false,
|
||||||
},
|
},
|
||||||
"rules": {
|
rules: {
|
||||||
// Disable base rule to avoid conflict
|
// Disable base rule to avoid conflict
|
||||||
"no-use-before-define": "off",
|
"no-use-before-define": "off",
|
||||||
|
|
||||||
"@typescript-eslint/consistent-type-assertions": [
|
"@typescript-eslint/consistent-type-assertions": [
|
||||||
"error",
|
"error",
|
||||||
{"assertionStyle": "never"}
|
{assertionStyle: "never"},
|
||||||
],
|
],
|
||||||
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
||||||
"@typescript-eslint/consistent-type-imports": "error",
|
"@typescript-eslint/consistent-type-imports": "error",
|
||||||
"@typescript-eslint/explicit-function-return-type": [
|
"@typescript-eslint/explicit-function-return-type": [
|
||||||
"error",
|
"error",
|
||||||
{"allowExpressions": true}
|
{allowExpressions: true},
|
||||||
],
|
],
|
||||||
"@typescript-eslint/member-ordering": "error",
|
"@typescript-eslint/member-ordering": "error",
|
||||||
"@typescript-eslint/method-signature-style": "error",
|
"@typescript-eslint/method-signature-style": "error",
|
||||||
|
@ -190,98 +192,98 @@
|
||||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"error",
|
"error",
|
||||||
{"args": "all", "argsIgnorePattern": "^_", "ignoreRestSiblings": true}
|
{args: "all", argsIgnorePattern: "^_", ignoreRestSiblings: true},
|
||||||
],
|
],
|
||||||
"@typescript-eslint/no-use-before-define": ["error", {"functions": false}],
|
"@typescript-eslint/no-use-before-define": ["error", {functions: false}],
|
||||||
"@typescript-eslint/parameter-properties": "error",
|
"@typescript-eslint/parameter-properties": "error",
|
||||||
"@typescript-eslint/promise-function-async": "error",
|
"@typescript-eslint/promise-function-async": "error",
|
||||||
"@typescript-eslint/restrict-plus-operands": ["error", {}],
|
"@typescript-eslint/restrict-plus-operands": ["error", {}],
|
||||||
"@typescript-eslint/restrict-template-expressions": ["error", {}],
|
"@typescript-eslint/restrict-template-expressions": ["error", {}],
|
||||||
"no-undef": "error"
|
"no-undef": "error",
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"files": ["**/*.d.ts"],
|
|
||||||
"rules": {
|
|
||||||
"import/unambiguous": "off"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"files": ["web/e2e-tests/**", "web/tests/**"],
|
|
||||||
"globals": {
|
|
||||||
"CSS": false,
|
|
||||||
"document": false,
|
|
||||||
"navigator": false,
|
|
||||||
"window": false
|
|
||||||
},
|
},
|
||||||
"rules": {
|
},
|
||||||
|
{
|
||||||
|
files: ["**/*.d.ts"],
|
||||||
|
rules: {
|
||||||
|
"import/unambiguous": "off",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["web/e2e-tests/**", "web/tests/**"],
|
||||||
|
globals: {
|
||||||
|
CSS: false,
|
||||||
|
document: false,
|
||||||
|
navigator: false,
|
||||||
|
window: false,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
"formatjs/no-id": "off",
|
"formatjs/no-id": "off",
|
||||||
"new-cap": "off",
|
"new-cap": "off",
|
||||||
"no-sync": "off",
|
"no-sync": "off",
|
||||||
"unicorn/prefer-prototype-methods": "off"
|
"unicorn/prefer-prototype-methods": "off",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["web/debug-require.js"],
|
files: ["web/debug-require.js"],
|
||||||
"env": {
|
env: {
|
||||||
"browser": true,
|
browser: true,
|
||||||
"es2020": false
|
es2020: false,
|
||||||
},
|
},
|
||||||
"rules": {
|
rules: {
|
||||||
// Don’t require ES features that PhantomJS doesn’t support
|
// Don’t require ES features that PhantomJS doesn’t support
|
||||||
// TODO: Toggle these settings now that we don't use PhantomJS
|
// TODO: Toggle these settings now that we don't use PhantomJS
|
||||||
"no-var": "off",
|
"no-var": "off",
|
||||||
"object-shorthand": "off",
|
"object-shorthand": "off",
|
||||||
"prefer-arrow-callback": "off"
|
"prefer-arrow-callback": "off",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["web/shared/**", "web/src/**", "web/third/**"],
|
files: ["web/shared/**", "web/src/**", "web/third/**"],
|
||||||
"env": {
|
env: {
|
||||||
"browser": true,
|
browser: true,
|
||||||
"node": false
|
node: false,
|
||||||
},
|
},
|
||||||
"globals": {
|
globals: {
|
||||||
"ZULIP_VERSION": false
|
ZULIP_VERSION: false,
|
||||||
},
|
},
|
||||||
"rules": {
|
rules: {
|
||||||
"no-console": "error"
|
"no-console": "error",
|
||||||
},
|
},
|
||||||
"settings": {
|
settings: {
|
||||||
"import/resolver": {
|
"import/resolver": {
|
||||||
"webpack": {
|
webpack: {
|
||||||
"config": "./web/webpack.config.ts"
|
config: "./web/webpack.config.ts",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["web/shared/**"],
|
files: ["web/shared/**"],
|
||||||
"env": {
|
env: {
|
||||||
"browser": false,
|
browser: false,
|
||||||
"shared-node-browser": true
|
"shared-node-browser": true,
|
||||||
},
|
},
|
||||||
"rules": {
|
rules: {
|
||||||
"import/no-restricted-paths": [
|
"import/no-restricted-paths": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"zones": [
|
zones: [
|
||||||
{
|
{
|
||||||
"target": "./web/shared",
|
target: "./web/shared",
|
||||||
"from": ".",
|
from: ".",
|
||||||
"except": ["./node_modules", "./web/shared"]
|
except: ["./node_modules", "./web/shared"],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"unicorn/prefer-string-replace-all": "off"
|
"unicorn/prefer-string-replace-all": "off",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["web/server/**"],
|
files: ["web/server/**"],
|
||||||
"env": {
|
env: {
|
||||||
"node": true
|
node: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
};
|
Loading…
Reference in New Issue