diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000000..418318a774f5 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,81 @@ +import babelParser from "babel-eslint"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [{ + ignores: [ + "services/web/client/source/resource/", + "services/web/client/contrib/", + "services/web/client/source-output/", + "services/*node_modules/", + "services/dy-modeling/client/source/resource/", + "services/dy-modeling/client/source-output/", + "services/dy-modeling/server/source/thrift/", + ], +}, ...compat.extends("eslint:recommended"), { + languageOptions: { + globals: { + osparc: false, + window: false, + }, + + parser: babelParser, + }, + + rules: { + "max-len": [2, 150], + "new-cap": "off", + "require-jsdoc": "off", + "linebreak-style": ["error", "unix"], + curly: ["warn", "all"], + "block-scoped-var": "warn", + "brace-style": ["warn", "1tbs"], + + indent: ["warn", 2, { + SwitchCase: 1, + }], + + "object-property-newline": "warn", + + "object-curly-newline": ["warn", { + ObjectExpression: { + multiline: true, + minProperties: 1, + }, + + ObjectPattern: { + multiline: true, + minProperties: 3, + }, + }], + + "key-spacing": ["warn", { + singleLine: { + beforeColon: false, + afterColon: true, + }, + + multiLine: { + beforeColon: false, + afterColon: true, + }, + }], + + "no-dupe-keys": "warn", + "no-dupe-class-members": "warn", + + "no-unused-vars": ["warn", { + args: "none", + }], + }, +}]; \ No newline at end of file diff --git a/services/static-webserver/client/eslint.config.mjs b/services/static-webserver/client/eslint.config.mjs new file mode 100644 index 000000000000..91943f773d29 --- /dev/null +++ b/services/static-webserver/client/eslint.config.mjs @@ -0,0 +1,59 @@ +import globals from "globals"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +// eslint-disable-next-line no-underscore-dangle +const __filename = fileURLToPath(import.meta.url); +// eslint-disable-next-line no-underscore-dangle +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [...compat.extends("qx"), { + languageOptions: { + globals: { + ...globals.browser, + qx: false, + q: false, + qxWeb: false, + osparc: false, + explorer: false, + Ajv: false, + objectPath: false, + }, + + ecmaVersion: 2017, + sourceType: "script", + }, + + rules: { + camelcase: ["error", { + properties: "always", + }], + + "no-underscore-dangle": ["error", { + allowAfterThis: true, + enforceInMethodNames: false, + }], + + "no-warning-comments": "off", + "no-confusing-arrow": "off", + "object-curly-newline": "off", + + "newline-per-chained-call": ["error", { + ignoreChainWithDepth: 3, + }], + + "no-eq-null": 0, + semi: "off", + "comma-dangle": "off", + "object-curly-spacing": "off", + "no-implicit-coercion": "off", + "arrow-body-style": "off", + }, +}]; diff --git a/tests/e2e/eslint.config.mjs b/tests/e2e/eslint.config.mjs new file mode 100644 index 000000000000..0d26be4e162e --- /dev/null +++ b/tests/e2e/eslint.config.mjs @@ -0,0 +1,23 @@ +import globals from "globals"; + +export default [{ + languageOptions: { + globals: { + ...globals.jest, + ...globals.node, + ...globals.browser, + page: true, + browser: true, + context: true, + jestPuppeteer: true, + console: true, + url: true, + apiVersion: true, + ourTimeout: true, + }, + }, + + rules: { + "no-console": "off", + }, +}]; \ No newline at end of file