mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-06 17:44:11 +00:00

Use the the `node:` protocol when importing Node.js builtin modules and enable rule in eslint to enforce. The `node:` protocol for Node.js builtin modules has been available since Node.js v14. See: https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/enforce-node-protocol-usage.md
387 lines
10 KiB
JSON
387 lines
10 KiB
JSON
{
|
|
"root": true,
|
|
"plugins": [
|
|
"@typescript-eslint",
|
|
"@angular-eslint/eslint-plugin",
|
|
"eslint-plugin-import",
|
|
"eslint-plugin-jsdoc",
|
|
"eslint-plugin-deprecation",
|
|
"unused-imports",
|
|
"eslint-plugin-lodash",
|
|
"eslint-plugin-jsonc",
|
|
"eslint-plugin-rxjs",
|
|
"eslint-plugin-simple-import-sort",
|
|
"eslint-plugin-import-newlines",
|
|
"dspace-angular-ts",
|
|
"dspace-angular-html"
|
|
],
|
|
"ignorePatterns": [
|
|
"lint/test/fixture"
|
|
],
|
|
"overrides": [
|
|
{
|
|
"files": [
|
|
"*.ts"
|
|
],
|
|
"parserOptions": {
|
|
"project": [
|
|
"./tsconfig.json",
|
|
"./cypress/tsconfig.json",
|
|
"./lint/tsconfig.json"
|
|
],
|
|
"createDefaultProgram": true
|
|
},
|
|
"extends": [
|
|
"eslint:recommended",
|
|
"plugin:@typescript-eslint/recommended",
|
|
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
"plugin:@angular-eslint/recommended",
|
|
"plugin:@angular-eslint/template/process-inline-templates",
|
|
"plugin:rxjs/recommended"
|
|
],
|
|
"rules": {
|
|
"indent": [
|
|
"error",
|
|
2,
|
|
{
|
|
"SwitchCase": 1,
|
|
"ignoredNodes": [
|
|
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
|
|
]
|
|
}
|
|
],
|
|
"max-classes-per-file": [
|
|
"error",
|
|
1
|
|
],
|
|
"comma-dangle": [
|
|
"error",
|
|
"always-multiline"
|
|
],
|
|
"object-curly-spacing": [
|
|
"error",
|
|
"always"
|
|
],
|
|
"eol-last": [
|
|
"error",
|
|
"always"
|
|
],
|
|
"no-console": [
|
|
"error",
|
|
{
|
|
"allow": [
|
|
"log",
|
|
"warn",
|
|
"dir",
|
|
"timeLog",
|
|
"assert",
|
|
"clear",
|
|
"count",
|
|
"countReset",
|
|
"group",
|
|
"groupEnd",
|
|
"table",
|
|
"debug",
|
|
"info",
|
|
"dirxml",
|
|
"error",
|
|
"groupCollapsed",
|
|
"Console",
|
|
"profile",
|
|
"profileEnd",
|
|
"timeStamp",
|
|
"context"
|
|
]
|
|
}
|
|
],
|
|
"curly": "error",
|
|
"brace-style": [
|
|
"error",
|
|
"1tbs",
|
|
{
|
|
"allowSingleLine": true
|
|
}
|
|
],
|
|
"eqeqeq": [
|
|
"error",
|
|
"always",
|
|
{
|
|
"null": "ignore"
|
|
}
|
|
],
|
|
"radix": "error",
|
|
"guard-for-in": "error",
|
|
"no-bitwise": "error",
|
|
"no-restricted-imports": "error",
|
|
"no-caller": "error",
|
|
"no-debugger": "error",
|
|
"no-redeclare": "error",
|
|
"no-eval": "error",
|
|
"no-fallthrough": "error",
|
|
"no-trailing-spaces": "error",
|
|
"space-infix-ops": "error",
|
|
"keyword-spacing": "error",
|
|
"no-var": "error",
|
|
"no-unused-expressions": [
|
|
"error",
|
|
{
|
|
"allowTernary": true
|
|
}
|
|
],
|
|
"prefer-const": "error",
|
|
"no-case-declarations": "error",
|
|
"no-extra-boolean-cast": "error",
|
|
"prefer-spread": "off",
|
|
"no-underscore-dangle": "off",
|
|
"no-prototype-builtins": "off",
|
|
"no-useless-escape": "off",
|
|
|
|
"@angular-eslint/directive-selector": [
|
|
"error",
|
|
{
|
|
"type": "attribute",
|
|
"prefix": "ds",
|
|
"style": "camelCase"
|
|
}
|
|
],
|
|
"@angular-eslint/component-selector": [
|
|
"error",
|
|
{
|
|
"type": "element",
|
|
"prefix": "ds",
|
|
"style": "kebab-case"
|
|
}
|
|
],
|
|
"@angular-eslint/pipe-prefix": [
|
|
"error",
|
|
{
|
|
"prefixes": [
|
|
"ds"
|
|
]
|
|
}
|
|
],
|
|
"@angular-eslint/prefer-standalone": [
|
|
"error"
|
|
],
|
|
"@angular-eslint/no-attribute-decorator": "error",
|
|
"@angular-eslint/no-output-native": "warn",
|
|
"@angular-eslint/no-output-on-prefix": "warn",
|
|
"@angular-eslint/no-conflicting-lifecycle": "warn",
|
|
"@angular-eslint/use-lifecycle-interface": "error",
|
|
|
|
"@typescript-eslint/no-inferrable-types":[
|
|
"error",
|
|
{
|
|
"ignoreParameters": true
|
|
}
|
|
],
|
|
"@typescript-eslint/quotes": [
|
|
"error",
|
|
"single",
|
|
{
|
|
"avoidEscape": true,
|
|
"allowTemplateLiterals": true
|
|
}
|
|
],
|
|
"@typescript-eslint/semi": "error",
|
|
"@typescript-eslint/no-shadow": "error",
|
|
"@typescript-eslint/dot-notation": "error",
|
|
"@typescript-eslint/consistent-type-definitions": "error",
|
|
"@typescript-eslint/prefer-function-type": "error",
|
|
"@typescript-eslint/naming-convention": [
|
|
"error",
|
|
{
|
|
"selector": "property",
|
|
"format": null
|
|
}
|
|
],
|
|
"@typescript-eslint/member-ordering": [
|
|
"error",
|
|
{
|
|
"default": [
|
|
"static-field",
|
|
"instance-field",
|
|
"static-method",
|
|
"instance-method"
|
|
]
|
|
}
|
|
],
|
|
"@typescript-eslint/type-annotation-spacing": "error",
|
|
"@typescript-eslint/unified-signatures": "error",
|
|
"@typescript-eslint/ban-types": "error",
|
|
"@typescript-eslint/no-floating-promises": "warn",
|
|
"@typescript-eslint/no-misused-promises": "warn",
|
|
"@typescript-eslint/restrict-plus-operands": "warn",
|
|
"@typescript-eslint/unbound-method": "off",
|
|
"@typescript-eslint/ban-ts-comment": "off",
|
|
"@typescript-eslint/no-var-requires": "off",
|
|
"@typescript-eslint/no-unused-vars": "off",
|
|
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
"@typescript-eslint/no-explicit-any": "off",
|
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
"@typescript-eslint/no-unsafe-call": "off",
|
|
"@typescript-eslint/no-unsafe-argument": "off",
|
|
"@typescript-eslint/no-unsafe-return": "off",
|
|
"@typescript-eslint/restrict-template-expressions": "off",
|
|
"@typescript-eslint/require-await": "off",
|
|
"@typescript-eslint/no-base-to-string": [
|
|
"error",
|
|
{
|
|
"ignoredTypeNames": [
|
|
"ResourceType",
|
|
"Error"
|
|
]
|
|
}
|
|
],
|
|
|
|
"deprecation/deprecation": "warn",
|
|
|
|
"simple-import-sort/imports": "error",
|
|
"simple-import-sort/exports": "error",
|
|
"import/order": "off",
|
|
"import/first": "error",
|
|
"import/newline-after-import": "error",
|
|
"import/no-duplicates": "error",
|
|
"import/no-deprecated": "warn",
|
|
"import/no-namespace": "error",
|
|
"import-newlines/enforce": [
|
|
"error",
|
|
{
|
|
"items": 1,
|
|
"semi": true,
|
|
"forceSingleLine": true
|
|
}
|
|
],
|
|
"import/enforce-node-protocol-usage": [
|
|
"error",
|
|
"always"
|
|
],
|
|
|
|
"unused-imports/no-unused-imports": "error",
|
|
"lodash/import-scope": [
|
|
"error",
|
|
"method"
|
|
],
|
|
|
|
"rxjs/no-nested-subscribe": "off", // todo: go over _all_ cases
|
|
|
|
// Custom DSpace Angular rules
|
|
"dspace-angular-ts/alias-imports": [
|
|
"error",
|
|
{
|
|
"aliases": [
|
|
{
|
|
"package": "rxjs",
|
|
"imported": "of",
|
|
"local": "of"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"dspace-angular-ts/themed-component-classes": "error",
|
|
"dspace-angular-ts/themed-component-selectors": "error",
|
|
"dspace-angular-ts/themed-component-usages": "error",
|
|
"dspace-angular-ts/themed-decorators": [
|
|
"off",
|
|
{
|
|
"decorators": {
|
|
"listableObjectComponent": 3,
|
|
"rendersSectionForMenu": 2
|
|
}
|
|
}
|
|
],
|
|
"dspace-angular-ts/themed-wrapper-no-input-defaults": "error",
|
|
"dspace-angular-ts/unique-decorators": [
|
|
"off",
|
|
{
|
|
"decorators": [
|
|
"listableObjectComponent"
|
|
]
|
|
}
|
|
],
|
|
"dspace-angular-ts/sort-standalone-imports": [
|
|
"error",
|
|
{
|
|
"locale": "en-US",
|
|
"maxItems": 0,
|
|
"indent": 2,
|
|
"trailingComma": true
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"files": [
|
|
"*.spec.ts"
|
|
],
|
|
"parserOptions": {
|
|
"project": [
|
|
"./tsconfig.json",
|
|
"./cypress/tsconfig.json"
|
|
],
|
|
"createDefaultProgram": true
|
|
},
|
|
"rules": {
|
|
"prefer-const": "off",
|
|
|
|
// Custom DSpace Angular rules
|
|
"dspace-angular-ts/themed-component-usages": "error"
|
|
}
|
|
},
|
|
{
|
|
"files": [
|
|
"*.html"
|
|
],
|
|
"extends": [
|
|
"plugin:@angular-eslint/template/recommended"
|
|
],
|
|
"rules": {
|
|
// Custom DSpace Angular rules
|
|
"dspace-angular-html/themed-component-usages": "error",
|
|
"dspace-angular-html/no-disabled-attribute-on-button": "error",
|
|
"@angular-eslint/template/prefer-control-flow": "error"
|
|
}
|
|
},
|
|
{
|
|
"files": [
|
|
"*.json5"
|
|
],
|
|
"extends": [
|
|
"plugin:jsonc/recommended-with-json5"
|
|
],
|
|
"rules": {
|
|
// The ESLint core no-irregular-whitespace rule doesn't work well in JSON
|
|
// See: https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-irregular-whitespace.html
|
|
"no-irregular-whitespace": "off",
|
|
"jsonc/no-irregular-whitespace": "error",
|
|
"no-trailing-spaces": "error",
|
|
"jsonc/comma-dangle": [
|
|
"error",
|
|
"always-multiline"
|
|
],
|
|
"jsonc/indent": [
|
|
"error",
|
|
2
|
|
],
|
|
"jsonc/key-spacing": [
|
|
"error",
|
|
{
|
|
"beforeColon": false,
|
|
"afterColon": true,
|
|
"mode": "strict"
|
|
}
|
|
],
|
|
"jsonc/no-dupe-keys": "off",
|
|
"jsonc/quotes": [
|
|
"error",
|
|
"double",
|
|
{
|
|
"avoidEscape": false
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|