mirror of https://github.com/zulip/zulip.git
337 lines
12 KiB
JSON
337 lines
12 KiB
JSON
{
|
||
"env": {
|
||
"es2020": true,
|
||
"node": true
|
||
},
|
||
"extends": [
|
||
"eslint:recommended",
|
||
"plugin:import/errors",
|
||
"plugin:import/warnings",
|
||
"plugin:unicorn/recommended",
|
||
"prettier"
|
||
],
|
||
"parser": "@babel/eslint-parser",
|
||
"parserOptions": {
|
||
"warnOnUnsupportedTypeScriptVersion": false,
|
||
"sourceType": "unambiguous"
|
||
},
|
||
"reportUnusedDisableDirectives": true,
|
||
"rules": {
|
||
"array-callback-return": "error",
|
||
"arrow-body-style": "error",
|
||
"block-scoped-var": "error",
|
||
"consistent-return": "error",
|
||
"curly": "error",
|
||
"dot-notation": "error",
|
||
"eqeqeq": "error",
|
||
"guard-for-in": "error",
|
||
"import/extensions": "error",
|
||
"import/first": "error",
|
||
"import/newline-after-import": "error",
|
||
"import/no-useless-path-segments": "error",
|
||
"import/order": [
|
||
"error",
|
||
{
|
||
"alphabetize": {"order": "asc"},
|
||
"newlines-between": "always"
|
||
}
|
||
],
|
||
"import/unambiguous": "error",
|
||
"lines-around-directive": "error",
|
||
"new-cap": "error",
|
||
"no-alert": "error",
|
||
"no-array-constructor": "error",
|
||
"no-bitwise": "error",
|
||
"no-caller": "error",
|
||
"no-catch-shadow": "error",
|
||
"no-constant-condition": ["error", {"checkLoops": false}],
|
||
"no-div-regex": "error",
|
||
"no-duplicate-imports": "error",
|
||
"no-else-return": "error",
|
||
"no-eq-null": "error",
|
||
"no-eval": "error",
|
||
"no-implicit-coercion": "error",
|
||
"no-implied-eval": "error",
|
||
"no-inner-declarations": "off",
|
||
"no-iterator": "error",
|
||
"no-label-var": "error",
|
||
"no-labels": "error",
|
||
"no-loop-func": "error",
|
||
"no-multi-str": "error",
|
||
"no-native-reassign": "error",
|
||
"no-new-func": "error",
|
||
"no-new-object": "error",
|
||
"no-new-wrappers": "error",
|
||
"no-octal-escape": "error",
|
||
"no-plusplus": "error",
|
||
"no-proto": "error",
|
||
"no-return-assign": "error",
|
||
"no-script-url": "error",
|
||
"no-self-compare": "error",
|
||
"no-sync": "error",
|
||
"no-throw-literal": "error",
|
||
"no-undef-init": "error",
|
||
"no-unneeded-ternary": ["error", {"defaultAssignment": false}],
|
||
"no-unused-expressions": "error",
|
||
"no-use-before-define": ["error", {"functions": false}],
|
||
"no-useless-concat": "error",
|
||
"no-useless-constructor": "error",
|
||
"no-var": "error",
|
||
"object-shorthand": "error",
|
||
"one-var": ["error", "never"],
|
||
"prefer-arrow-callback": "error",
|
||
"prefer-const": [
|
||
"error",
|
||
{
|
||
"ignoreReadBeforeAssign": true
|
||
}
|
||
],
|
||
"radix": "error",
|
||
"spaced-comment": "off",
|
||
"strict": "error",
|
||
"unicorn/consistent-function-scoping": "off",
|
||
"unicorn/explicit-length-check": "off",
|
||
"unicorn/filename-case": "off",
|
||
"unicorn/no-nested-ternary": "off",
|
||
"unicorn/no-null": "off",
|
||
"unicorn/no-process-exit": "off",
|
||
"unicorn/no-useless-undefined": "off",
|
||
"unicorn/number-literal-case": "off",
|
||
"unicorn/prefer-spread": "off",
|
||
"unicorn/prefer-ternary": "off",
|
||
"unicorn/prevent-abbreviations": "off",
|
||
"valid-typeof": ["error", {"requireStringLiterals": true}],
|
||
"yoda": "error"
|
||
},
|
||
"overrides": [
|
||
{
|
||
"files": ["frontend_tests/node_tests/**"],
|
||
"globals": {
|
||
"blueslip": false,
|
||
"current_msg_list": false,
|
||
"home_msg_list": false,
|
||
"i18n": false,
|
||
"location": false
|
||
}
|
||
},
|
||
{
|
||
"files": ["frontend_tests/puppeteer_lib/**", "frontend_tests/puppeteer_tests/**"],
|
||
"globals": {
|
||
"$": false,
|
||
"current_msg_list": false
|
||
}
|
||
},
|
||
{
|
||
"files": ["static/js/**"],
|
||
"globals": {
|
||
"$": false,
|
||
"activity": false,
|
||
"admin": false,
|
||
"alert_words_ui": false,
|
||
"attachments_ui": false,
|
||
"avatar": false,
|
||
"blueslip": false,
|
||
"bot_data": false,
|
||
"buddy_data": false,
|
||
"buddy_list": false,
|
||
"click_handlers": false,
|
||
"compose_actions": false,
|
||
"compose_ui": false,
|
||
"composebox_typeahead": false,
|
||
"confirm_dialog": false,
|
||
"csrf_token": false,
|
||
"current_msg_list": true,
|
||
"dropdown_list_widget": false,
|
||
"emoji_picker": false,
|
||
"favicon": false,
|
||
"flatpickr": false,
|
||
"gear_menu": false,
|
||
"hash_util": false,
|
||
"hashchange": false,
|
||
"helpers": false,
|
||
"history": false,
|
||
"home_msg_list": false,
|
||
"hotspots": false,
|
||
"i18n": false,
|
||
"info_overlay": false,
|
||
"input_pill": false,
|
||
"jQuery": false,
|
||
"list_util": false,
|
||
"localStorage": false,
|
||
"location": false,
|
||
"message_events": false,
|
||
"message_fetch": false,
|
||
"message_flags": false,
|
||
"message_list": false,
|
||
"message_scroll": false,
|
||
"message_store": false,
|
||
"message_util": false,
|
||
"narrow": false,
|
||
"navigate": false,
|
||
"night_mode": false,
|
||
"notifications": false,
|
||
"overlays": false,
|
||
"padded_widget": false,
|
||
"page_params": false,
|
||
"panels": false,
|
||
"pointer": false,
|
||
"popovers": false,
|
||
"presence": false,
|
||
"reactions": false,
|
||
"realm_icon": false,
|
||
"realm_logo": false,
|
||
"realm_night_logo": false,
|
||
"recent_topics": false,
|
||
"reminder": false,
|
||
"scroll_bar": false,
|
||
"search": false,
|
||
"search_pill_widget": false,
|
||
"search_suggestion": false,
|
||
"server_events": false,
|
||
"settings": false,
|
||
"settings_account": false,
|
||
"settings_bots": false,
|
||
"settings_display": false,
|
||
"settings_emoji": false,
|
||
"settings_exports": false,
|
||
"settings_linkifiers": false,
|
||
"settings_invites": false,
|
||
"settings_notifications": false,
|
||
"settings_org": false,
|
||
"settings_panel_menu": false,
|
||
"settings_profile_fields": false,
|
||
"settings_sections": false,
|
||
"settings_streams": false,
|
||
"settings_toggle": false,
|
||
"settings_user_groups": false,
|
||
"settings_users": false,
|
||
"starred_messages": false,
|
||
"stream_list": false,
|
||
"stream_popover": false,
|
||
"StripeCheckout": false,
|
||
"subs": false,
|
||
"message_view_header": false,
|
||
"timerender": false,
|
||
"typeahead_helper": false,
|
||
"typing_events": false,
|
||
"ui": false,
|
||
"ui_init": false,
|
||
"ui_util": false,
|
||
"unread": false,
|
||
"unread_ops": false,
|
||
"upload_widget": false,
|
||
"user_events": false,
|
||
"widgetize": false,
|
||
"zxcvbn": false
|
||
}
|
||
},
|
||
{
|
||
"files": ["**/*.ts"],
|
||
"extends": [
|
||
"plugin:@typescript-eslint/recommended",
|
||
"plugin:import/typescript",
|
||
"prettier/@typescript-eslint"
|
||
],
|
||
"parserOptions": {
|
||
"project": "tsconfig.json"
|
||
},
|
||
"rules": {
|
||
// Disable base rule to avoid conflict
|
||
"no-unused-vars": "off",
|
||
"no-useless-constructor": "off",
|
||
|
||
"@typescript-eslint/array-type": "error",
|
||
"@typescript-eslint/await-thenable": "error",
|
||
"@typescript-eslint/consistent-type-assertions": "error",
|
||
"@typescript-eslint/explicit-function-return-type": [
|
||
"error",
|
||
{"allowExpressions": true}
|
||
],
|
||
"@typescript-eslint/member-ordering": "error",
|
||
"@typescript-eslint/no-explicit-any": "off",
|
||
"@typescript-eslint/no-extraneous-class": "error",
|
||
"@typescript-eslint/no-non-null-assertion": "off",
|
||
"@typescript-eslint/no-parameter-properties": "error",
|
||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||
"@typescript-eslint/no-unused-vars": ["error", {"varsIgnorePattern": "^_"}],
|
||
"@typescript-eslint/no-use-before-define": "error",
|
||
"@typescript-eslint/no-useless-constructor": "error",
|
||
"@typescript-eslint/prefer-includes": "error",
|
||
"@typescript-eslint/prefer-regexp-exec": "error",
|
||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||
"@typescript-eslint/promise-function-async": "error",
|
||
"@typescript-eslint/unified-signatures": "error"
|
||
}
|
||
},
|
||
{
|
||
"files": ["**/*.d.ts"],
|
||
"rules": {
|
||
"import/unambiguous": "off"
|
||
}
|
||
},
|
||
{
|
||
"files": ["frontend_tests/**"],
|
||
"globals": {
|
||
"CSS": false,
|
||
"document": false,
|
||
"navigator": false,
|
||
"window": false
|
||
},
|
||
"rules": {
|
||
"no-sync": "off"
|
||
}
|
||
},
|
||
{
|
||
"files": ["tools/debug-require.js"],
|
||
"env": {
|
||
"browser": true,
|
||
"es2020": false
|
||
},
|
||
"rules": {
|
||
// Don’t require ES features that PhantomJS doesn’t support
|
||
// TODO: Toggle these settings now that we don't use PhantomJS
|
||
"no-var": "off",
|
||
"object-shorthand": "off",
|
||
"prefer-arrow-callback": "off"
|
||
}
|
||
},
|
||
{
|
||
"files": ["static/**"],
|
||
"env": {
|
||
"browser": true,
|
||
"commonjs": true,
|
||
"node": false
|
||
},
|
||
"rules": {
|
||
"no-console": "error"
|
||
},
|
||
"settings": {
|
||
"import/resolver": "webpack"
|
||
}
|
||
},
|
||
{
|
||
"files": ["static/shared/**"],
|
||
"env": {
|
||
"browser": false,
|
||
"commonjs": false,
|
||
"shared-node-browser": true
|
||
},
|
||
"rules": {
|
||
"import/no-restricted-paths": [
|
||
"error",
|
||
{
|
||
"zones": [
|
||
{
|
||
"target": "./static/shared",
|
||
"from": ".",
|
||
"except": ["./node_modules", "./static/shared"]
|
||
}
|
||
]
|
||
}
|
||
]
|
||
}
|
||
}
|
||
]
|
||
}
|