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

191 lines
6.4 KiB

module.exports = {
extends: [
"eslint:recommended",
Feature/storybook (#10797) Squash commit of storybook addition to aid design system documentation efforts. The older commit titles were: * Initial storybook commit * Fix documentation.json links * Don't track documentation.json in git * Enable sass in storybook * Initial version of a story that uses angular components * Remove example stories, clean up button story * More example stories * Fix sb build * Always use dev * Try without auth header * Update workflow name * More logs * Check if token set * Use release/storybook branch for testing * Send ref input to workflow * Escape input to curl call * Adding logging * Different type of escaping * Fix JOSN * Use dev branch for opf/design-system storybook publishing * Add plugin to message path to parent window * Remove extraneous story * Add a ton of docs * Update stories * Fix syntax error caused by multiple newlines inside of a JSX component * Add text-field story * Add basic html stories that don't work yet * Try to get plain HTML examples working * HTML Examples work, but slowly revert to components anyway * Fix HTML examples * Remove extraneous files * Put storybook eslint rules back in * Improve docs * Show docs tab by default * Add pullpreview for storybook * Use the same pullpreview tag for both storybook and normal deployments * Change name of second pullpreview workflow * Pin node version to 16.17.0 * Initial update to docs Added/updated: Foundation pages: - Colours (major update) - Shadows (minor) - Typography (new) Blocks - Checkbox (minor) - Action bar (major) - Buttons (new) - Link (major) - Modal Dialogue (new) - Selector Field (new) * Make sure all code is available during storybook pp build * Change storybook pullpreview file name * Add production target to docker-compose sb pp * Fix acme check for sb pp * Only run cd-storybook on dev branch * Run without https on 8080 * Added intro and new page - Introduction renamed to "Design System", page rewritten completely - Added page "Devices and Accessibility" * Remove domain from caddy * Add port to listen command * Remove double pullpreview workflows * Added Divider component * Change sorting of stories * Update section titles and order for styles and blocks * add extra action bar story * Updated organising + new page - Updated organisation into Styles, Components and Patterns. - Added page "Using Storybook" (mostly a skeleton for now) * Added note about colours not being implemented yet * Minor Co-authored-by: Parimal Satyal <88370597+psatyal@users.noreply.github.com>
2 years ago
"plugin:storybook/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-base",
"airbnb-typescript/base",
],
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",
3 years ago
{ "type": "attribute", "prefix": ["op", "spot"], "style": "camelCase" }
],
"@angular-eslint/component-selector": [
"error",
3 years ago
{ "type": "element", "prefix": ["op", "spot"], "style": "kebab-case" }
],
"@angular-eslint/component-class-suffix": ["error", { "suffixes": ["Component", "Example"] }],
// Warn when new components are being created without OnPush
"change-detection-strategy/on-push": "error",
"no-console": [
"error",
{
allow: [
"warn",
"error",
],
},
],
// Sometimes we need to shush the TypeScript compiler
"no-unused-vars": ["error", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
// Who cares about line length
"max-len": "off",
// Allow short circuit evaluations
"@typescript-eslint/no-unused-expressions": ["error", { "allowShortCircuit": true }],
// 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 param reassignment is a pain when trying to set props on elements
"no-param-reassign": "off",
// destructuring doesn't always look better, only when object/array destructuring
"prefer-destructuring": "off",
// Sometimes, arrow functions implicit return looks better below, so allow both
"implicit-arrow-linebreak": "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 no-use for functions and classes
"no-use-before-define": ["error", { "functions": false, "classes": false }],
"@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": false }],
/*
// 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 writing type union and type intersections without space
"@typescript-eslint/space-infix-ops": "off",
// 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: {
}
},
{
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",
}
}
],
};