{ "parser": "@typescript-eslint/parser", "parserOptions": { "sourceType": "module" }, "extends": [ "eslint:recommended" ], "plugins": [ "angular", "html", "unused-imports", "@typescript-eslint", "oppia" ], "overrides": [ { // We exclude test files from dependency injection format checks because // they are never minified. "files": ["*Spec.js", "*Spec.ts"], "rules": { "angular/di": "off" } }, { // We only run the e2e action checks on end-to-end test files, and // we exclude files that we haven't fixed yet. "files": [ "core/tests/protractor/*.js", "core/tests/protractor_utils/*.js", "core/tests/protractor_desktop/*.js" ], "excludedFiles": [ "ClassroomPage.js", "DeleteAccountPage.js", "ExplorationEditorHistoryTab.js", "ExplorationEditorMainTab.js", "ExplorationEditorPage.js", "ExplorationEditorSettingsTab.js", "ExplorationEditorStatsTab.js", "ExplorationEditorTranslationTab.js", "GetStartedPage.js", "LearnerDashboardPage.js", "LibraryPage.js", "ProfilePage.js", "ProtractorConstants.js", "SkillEditorPage.js", "StoryEditorPage.js", "SubscriptionDashboardPage.js", "ThanksPage.js", "TopicAndStoryViewerPage.js", "TopicEditorPage.js", "TopicsAndSkillsDashboardPage.js", "action.js", "forms.js", "general.js", "users.js", "waitFor.js", "workflow.js", "additionalEditorFeatures.js", "additionalPlayerFeatures.js", "adminTabFeatures.js", "classroomPage.js", "classroomPageFileUploadFeatures.js", "collections.js", "contributorDashboard.js", "coreEditorAndPlayerFeatures.js", "creatorDashboard.js", "embedding.js", "explorationFeedbackTab.js", "explorationHistoryTab.js", "explorationImprovementsTab.js", "explorationStatisticsTab.js", "explorationTranslationTab.js", "extensions.js", "fileUploadExtensions.js", "learnerDashboard.js", "navigation.js", "playVoiceovers.js", "preferences.js", "profileFeatures.js", "publicationAndLibrary.js", "skillEditor.js", "topicAndStoryEditor.js", "topicAndStoryEditorFileUploadFeatures.js", "topicAndStoryViewer.js", "topicsAndSkillsDashboard.js", "userJourneys.js", "voiceoverUploadFeatures.js", "wipeout.js", "accessibility.js", "learnerFlow.js", "libraryFlow.js", "profileMenuFlow.js", "excludedForTesting.js" ], "rules": { "oppia/e2e-action": "error", } }, { // We only run the protractor practices checks on protractor end-to-end test files. "files": [ "core/tests/protractor/*.js", "core/tests/protractor_utils/*.js", "core/tests/protractor_desktop/*.js" ], "rules": { "oppia/protractor-practices": "error", } } ], "rules": { "oppia/break-after-parens": "error", "oppia/no-multiline-disable": "error", "oppia/test-message-style": "error", "oppia/dependency-checks": "error", "angular/di": [ "error", "array" ], "angular/di-unused": "error", "angular/directive-restrict": [ "error", { "restrict": "E" } ], "angular/no-inline-template": [ "error", { "allowSimple": true } ], "array-bracket-spacing": [ "error", "never" ], "brace-style":[ "error", "1tbs" ], "camelcase": [ "error", { "properties": "never" } ], "capitalized-comments": [ "error", "always", { "ignorePattern": "disable-bad-pattern-check|fall-through", "ignoreConsecutiveComments": true } ], "comma-spacing": [ "error", { "before": false, "after": true } ], "curly": [ "error", "all" ], "dot-notation": [ "error", { "allowKeywords": false } ], "eol-last":[ "error", "always" ], "eqeqeq": [ "error", "always" ], "func-style": [ "error", "expression" ], "indent": [ "error", 2, { "ArrayExpression": 1, "flatTernaryExpressions": true, "FunctionExpression": { "body": 1, "parameters": 2 }, "MemberExpression": 1, "SwitchCase": 1, "ignoredNodes": [ "ConditionalExpression" ] } ], "key-spacing": "error", "keyword-spacing": [ "error", { "before": true, "after": true } ], "max-len": [ "error", { "code": 80, "ignoreUrls": true, "ignorePattern": "^import \\{" } ], "no-compare-neg": "off", "no-console": [ "error", { "allow": [ "error", "warn" ] } ], "no-constant-condition": [ "off" ], "no-empty": [ "error", { "allowEmptyCatch": true } ], "no-multi-spaces": [ "error" ], "no-multi-str": [ "error" ], "no-prototype-builtins": "off", "no-redeclare": [ "off" ], "no-restricted-globals": [ "error", "addEventListener", "blur", "close", "closed", "confirm", "defaultStatus", "event", "external", "defaultstatus", "find", "focus", "frameElement", "frames", "history", "innerHeight", "innerWidth", "length", "location", "locationbar", "menubar", "moveBy", "moveTo", "name", "onblur", "onerror", "onfocus", "onload", "onresize", "onunload", "open", "opener", "opera", "outerHeight", "outerWidth", "pageXOffset", "pageYOffset", "parent", "print", "removeEventListener", "resizeBy", "resizeTo", "screen", "screenLeft", "screenTop", "screenX", "screenY", "scroll", "scrollbars", "scrollBy", "scrollTo", "scrollX", "scrollY", "self", "sessionStorage", "status", "statusbar", "stop", "toolbar", "top"], "no-tabs": "error", "no-useless-escape": "off", "no-whitespace-before-property": "error", "no-trailing-spaces": [ "error" ], "no-undef": [ "off" ], "no-unused-vars": [ "off" ], "one-var": [ "off" ], "operator-linebreak": [ "error", "after" ], "padded-blocks": [ "error", "never" ], "quotes": [ "error", "single", { "avoidEscape": true } ], "quote-props": [ "error", "as-needed", { "keywords": true } ], // The following must be off so that we can enable // "@typescript-eslint/semi", which checks semicolons in TS files. "semi": "off", // The following must be off so that we can enable // "@typescript-eslint/no-extra-semi". "no-extra-semi": "off", "semi-spacing": "error", "space-before-blocks": [ "error", "always" ], "space-before-function-paren": [ "error", { "anonymous": "never", "asyncArrow": "never", "named": "never" } ], "spaced-comment": [ "error", "always" ], "space-in-parens": [ "error", "never" ], "space-infix-ops": [ "error" ], "space-unary-ops": [ "error", { "words": true, "nonwords": false } ], "switch-colon-spacing": [ "error", { "after": true, "before": false } ], "unused-imports/no-unused-imports-ts": "error", "@typescript-eslint/no-explicit-any": ["error"], "@typescript-eslint/semi": ["error"], "@typescript-eslint/ban-types": [ "error", { "types": { "String": { "message": "Use string instead.", "fixWith": "string" }, "Number": { "message": "Use number instead.", "fixWith": "number" }, "Boolean": { "message": "Use boolean instead.", "fixWith": "boolean" } }, "extendDefaults": false } ], "@typescript-eslint/array-type": [ "error", { "default": "array" } ], "@typescript-eslint/no-non-null-assertion": ["error"], "@typescript-eslint/no-non-null-asserted-optional-chain": ["error"], "@typescript-eslint/prefer-namespace-keyword": ["error"], "@typescript-eslint/triple-slash-reference": ["error"], "@typescript-eslint/adjacent-overload-signatures": ["error"], "@typescript-eslint/no-extra-non-null-assertion": ["error"], "@typescript-eslint/no-misused-new": ["error"], "@typescript-eslint/no-unused-vars": [ "error", { "args": "none" } ], "@typescript-eslint/explicit-module-boundary-types": ["error"], "@typescript-eslint/prefer-as-const": ["error"], "@typescript-eslint/no-array-constructor": ["error"], "@typescript-eslint/no-extra-semi": ["error"], "@typescript-eslint/type-annotation-spacing": ["error"], "wrap-iife": [ "error", "any" ] } }