OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/frontend/.eslintrc.js

170 lines
5.3 KiB

module.exports = {
extends: [
"eslint:recommended",
],
env: {
browser: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./src/tsconfig.app.json",
tsconfigRootDir: __dirname,
sourceType: "module",
createDefaultProgram: true,
},
plugins: [
"@typescript-eslint",
"change-detection-strategy",
"jasmine",
],
overrides: [
{
files: ["*.ts"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./src/tsconfig.app.json",
tsconfigRootDir: __dirname,
sourceType: "module",
createDefaultProgram: true
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@angular-eslint/recommended",
// This is required if you use inline templates in Components
"plugin:@angular-eslint/template/process-inline-templates",
"airbnb-typescript",
],
rules: {
/**
* Any TypeScript source code (NOT TEMPLATE) related rules you wish to use/reconfigure over and above the
* recommended set provided by the @angular-eslint project would go here.
*/
"@angular-eslint/directive-selector": [
"error",
{ "type": "attribute", "prefix": "op", "style": "camelCase" }
],
"@angular-eslint/component-selector": [
"error",
{ "type": "element", "prefix": "op", "style": "kebab-case" }
],
// Warn when new components are being created without OnPush
"change-detection-strategy/on-push": "error",
"no-console": [
"error",
{
allow: [
"warn",
"error",
],
},
],
// Who cares about line length
"max-len": "off",
// Force single quotes to align with ruby
quotes: "off",
"@typescript-eslint/quotes": ["error", "single", { avoidEscape: true }],
// Disable webpack loader definitions
"import/no-webpack-loader-syntax": "off",
// Disable order style as it's not compatible with intellij import organization
"import/order": "off",
// It'd be good if we could error this for switch cases but allow it for for loops
"no-continue": "off",
// No void at all collides with `@typescript-eslint/no-floating-promises` which wants us to handle each promise.
// Until we do that, `void` is a good way to explicitly mark unhandled promises.
"no-void": ["error", { allowAsStatement: true }],
/*
// Disable use before define, as irrelevant for TS interfaces
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "off",
*/
// Whitespace configuration
"@typescript-eslint/type-annotation-spacing": [
"error",
{
before: false,
after: false,
overrides: {
arrow: {
before: true,
after: true,
},
},
},
],
// Allow empty interfaces for naming purposes (HAL resources)
"@typescript-eslint/no-empty-interface": "off",
"import/prefer-default-export": "off",
// HAL has a lot of dangling properties, so allow
// usage in properties but not in all other places
"no-underscore-dangle": [
"warn",
{
allow: [
"_links",
"_embedded",
"_meta",
Feature/40330 projects include filter (#10199) * Add SPOT foundation styles * Initial work on buttons * Implement basic examples page * Improve spot-checkbox * Add outline buttons in HTML * Checkbox works * Add filter chips * Initial text field implementation * Chip field initial implementation, add filter-chip component * Keep old styleguide page * Add drop modal component * Finish checkbox list * Improve action bar * Add drop modal alignment options * Fix drop modal zindex * Make sure clicks do not close the drop modal, add escape closing event for drop modal * Add spot-body * Don't hide drop modal body via display * Start work on project select * Add basic form * Switch to FormGroup * Generate project data structure * Basic selecting and unselecting works * Update buttons and colors * Add basic button type * Start work on project select * Add basic form * Switch to FormGroup * Generate project data structure * Basic selecting and unselecting works * Increase specificity of toolbar button styles * Set line height for typography styles * Fix buttons * Filtering works * Add basic toggle component * Work on better sorting * Set to query space filters * Better docs * Fix disabling current project * Select and deselect works * Don't use reactive forms * Fix heading styles * Fix toggle font size * Add number of projects to button * Change the position of the project include modal in th ework packages table * Add project include tp spec file, also search for assignees in other projects in tp * Add current date color * Rename project-select, initial specs working * Fix names for form components * Fix lst add assignee spec * Add specs for calendar * Add specs for calendar and wp, refactor specs * i18nify the strings, remove button to select subprojects * Fix import to typogrpahy after DS got merged This otherwise raises an error * Fix filtering for projects * Show badge content only when loaded * Linting * Move duplicated specs into a shared example * Improve selectors with retry_blocks Co-authored-by: Benjamin Bädorf <b.baedorf@openproject.com>
3 years ago
"_type",
],
Feature/40330 projects include filter (#10199) * Add SPOT foundation styles * Initial work on buttons * Implement basic examples page * Improve spot-checkbox * Add outline buttons in HTML * Checkbox works * Add filter chips * Initial text field implementation * Chip field initial implementation, add filter-chip component * Keep old styleguide page * Add drop modal component * Finish checkbox list * Improve action bar * Add drop modal alignment options * Fix drop modal zindex * Make sure clicks do not close the drop modal, add escape closing event for drop modal * Add spot-body * Don't hide drop modal body via display * Start work on project select * Add basic form * Switch to FormGroup * Generate project data structure * Basic selecting and unselecting works * Update buttons and colors * Add basic button type * Start work on project select * Add basic form * Switch to FormGroup * Generate project data structure * Basic selecting and unselecting works * Increase specificity of toolbar button styles * Set line height for typography styles * Fix buttons * Filtering works * Add basic toggle component * Work on better sorting * Set to query space filters * Better docs * Fix disabling current project * Select and deselect works * Don't use reactive forms * Fix heading styles * Fix toggle font size * Add number of projects to button * Change the position of the project include modal in th ework packages table * Add project include tp spec file, also search for assignees in other projects in tp * Add current date color * Rename project-select, initial specs working * Fix names for form components * Fix lst add assignee spec * Add specs for calendar * Add specs for calendar and wp, refactor specs * i18nify the strings, remove button to select subprojects * Fix import to typogrpahy after DS got merged This otherwise raises an error * Fix filtering for projects * Show badge content only when loaded * Linting * Move duplicated specs into a shared example * Improve selectors with retry_blocks Co-authored-by: Benjamin Bädorf <b.baedorf@openproject.com>
3 years ago
allowAfterThis: true,
allowAfterSuper: false,
allowAfterThisConstructor: false,
enforceInMethodNames: true,
Feature/40330 projects include filter (#10199) * Add SPOT foundation styles * Initial work on buttons * Implement basic examples page * Improve spot-checkbox * Add outline buttons in HTML * Checkbox works * Add filter chips * Initial text field implementation * Chip field initial implementation, add filter-chip component * Keep old styleguide page * Add drop modal component * Finish checkbox list * Improve action bar * Add drop modal alignment options * Fix drop modal zindex * Make sure clicks do not close the drop modal, add escape closing event for drop modal * Add spot-body * Don't hide drop modal body via display * Start work on project select * Add basic form * Switch to FormGroup * Generate project data structure * Basic selecting and unselecting works * Update buttons and colors * Add basic button type * Start work on project select * Add basic form * Switch to FormGroup * Generate project data structure * Basic selecting and unselecting works * Increase specificity of toolbar button styles * Set line height for typography styles * Fix buttons * Filtering works * Add basic toggle component * Work on better sorting * Set to query space filters * Better docs * Fix disabling current project * Select and deselect works * Don't use reactive forms * Fix heading styles * Fix toggle font size * Add number of projects to button * Change the position of the project include modal in th ework packages table * Add project include tp spec file, also search for assignees in other projects in tp * Add current date color * Rename project-select, initial specs working * Fix names for form components * Fix lst add assignee spec * Add specs for calendar * Add specs for calendar and wp, refactor specs * i18nify the strings, remove button to select subprojects * Fix import to typogrpahy after DS got merged This otherwise raises an error * Fix filtering for projects * Show badge content only when loaded * Linting * Move duplicated specs into a shared example * Improve selectors with retry_blocks Co-authored-by: Benjamin Bädorf <b.baedorf@openproject.com>
3 years ago
allowFunctionParams: true,
}
],
"no-return-assign": ["error", "except-parens"],
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
//////////////////////////////////////////////////////////////////////
// Anything below this line should be turned on again at some point //
//////////////////////////////////////////////////////////////////////
// It's common in Angular to wrap even pure functions in classes for injection purposes
"class-methods-use-this": "off",
}
},
{
files: ["*.html"],
extends: ["plugin:@angular-eslint/template/recommended"],
rules: {
/**
* Any template/HTML related rules you wish to use/reconfigure over and above the
* recommended set provided by the @angular-eslint project would go here.
*/
3 years ago
"@angular-eslint/template/no-call-expression": 2,
}
},
{
files: ["*.spec.ts"],
extends: ["plugin:jasmine/recommended"],
rules: {
/**
* Any template/HTML related rules you wish to use/reconfigure over and above the
* recommended set provided by the @angular-eslint project would go here.
*/
// jasmine is unusable with unsafe member access, as expect(...) is always any
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
// Allow more than one class definitions per file (test components)
"max-classes-per-file": "off",
}
}
],
};