Skip to content

Commit 2e134b2

Browse files
Merge pull request #234 from ITISFoundation/add-tooling
Add tooling to MMUX repository front-end
2 parents 055f00a + 34ac701 commit 2e134b2

File tree

113 files changed

+21866
-25698
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+21866
-25698
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dist-ssr
2222
# Editor directories and files
2323
.vscode/*
2424
!.vscode/extensions.json
25+
!.vscode/settings.json
2526
.idea
2627
.DS_Store
2728
*.suo

.vscode/settings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll.eslint": "explicit"
6+
},
7+
"typescript.tsdk": "node_modules/typescript/lib",
8+
"typescript.enablePromptUseWorkspaceTsdk": true,
9+
"eslint.workingDirectories": [
10+
{ "directory": "./node", "changeProcessCWD": true }
11+
]
12+
}

node/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/osparc-api-ts-client
2+
dist

node/.prettierrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"trailingComma": "all",
3+
"arrowParens": "avoid",
4+
"tabWidth": 2,
5+
"useTabs": false,
6+
"endOfLine": "auto",
7+
"printWidth": 130,
8+
"bracketSpacing": true,
9+
"bracketSameLine": false,
10+
"semi": true,
11+
"singleQuote": false
12+
}

node/eslint.config.js

Lines changed: 98 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,109 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
5-
import tseslint from 'typescript-eslint'
1+
// eslint.config.js
2+
import path from "path";
3+
import { fileURLToPath } from "url";
4+
import { FlatCompat } from "@eslint/eslintrc";
5+
import tsParser from "@typescript-eslint/parser";
6+
import pluginPrettier from "eslint-plugin-prettier";
7+
import pluginImport from "eslint-plugin-import";
8+
import pluginReact from "eslint-plugin-react";
9+
import pluginReactHooks from "eslint-plugin-react-hooks";
10+
import pluginTs from "@typescript-eslint/eslint-plugin";
611

7-
export default tseslint.config(
8-
{ ignores: ['dist', "src/osparc-api-ts-client/*"] },
12+
// __dirname in ESM
13+
const __filename = fileURLToPath(import.meta.url);
14+
const __dirname = path.dirname(__filename);
15+
16+
// Pass in ESLint’s own recommended config
17+
const compat = new FlatCompat({
18+
baseDirectory: __dirname,
19+
recommendedConfig: {},
20+
});
21+
export default [
22+
{
23+
ignores: [
24+
"**", // ignore everything
25+
"!src/**", // except files under src/
26+
"src/osparc-api-ts-client/**", // ignore osparc-api-ts-client
27+
],
28+
},
929
{
10-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
30+
plugins: {
31+
prettier: pluginPrettier,
32+
import: pluginImport,
33+
react: pluginReact,
34+
"react-hooks": pluginReactHooks,
35+
"@typescript-eslint": pluginTs,
36+
},
1237
languageOptions: {
13-
ecmaVersion: 2020,
14-
globals: globals.browser,
38+
parser: tsParser,
39+
parserOptions: {
40+
project: path.resolve(__dirname, "./tsconfig.app.json"),
41+
tsconfigRootDir: __dirname,
42+
sourceType: "module",
43+
ecmaFeatures: { jsx: true },
44+
},
1545
},
16-
plugins: {
17-
'react-hooks': reactHooks,
18-
'react-refresh': reactRefresh,
46+
},
47+
...compat.extends(
48+
"eslint:recommended",
49+
"plugin:react/jsx-runtime",
50+
"plugin:import/recommended",
51+
"plugin:import/typescript",
52+
"plugin:react-hooks/recommended",
53+
"plugin:@typescript-eslint/recommended",
54+
"airbnb",
55+
"airbnb-typescript",
56+
"airbnb/hooks",
57+
"prettier",
58+
),
59+
60+
// 2) Your custom overrides for JS/TS files
61+
{
62+
files: ["src/**/*.{js,jsx,ts,tsx}"],
63+
settings: {
64+
react: {
65+
version: "detect",
66+
runtime: "automatic",
67+
},
68+
"import/resolver": {
69+
typescript: { project: "./tsconfig.json" },
70+
alias: {
71+
map: [["@", "./src"]],
72+
extensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
73+
},
74+
},
1975
},
76+
2077
rules: {
21-
...reactHooks.configs.recommended.rules,
78+
"react/react-in-jsx-scope": "off",
79+
"react/prop-types": "off",
80+
"prettier/prettier": ["error"],
81+
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
82+
"no-underscore-dangle": "off",
83+
"react/require-default-props": "off",
84+
"react/function-component-definition": "off",
85+
"import/prefer-default-export": "off",
86+
"react/jsx-no-useless-fragment": "off",
87+
"no-restricted-syntax": "off",
88+
"@typescript-eslint/lines-between-class-members": "off",
89+
"max-classes-per-file": ["warn", 2],
90+
"prefer-regex-literals": "off",
91+
"no-control-regex": "off",
92+
"no-console": "off",
93+
"no-await-in-loop": "off",
94+
"react/jsx-props-no-spreading": "off",
2295
"@typescript-eslint/no-unused-vars": [
23-
"warn", // or "error"
96+
"error",
2497
{
25-
"argsIgnorePattern": "^_",
26-
"varsIgnorePattern": "^_",
27-
"caughtErrorsIgnorePattern": "^_"
28-
}
29-
],
30-
'react-refresh/only-export-components': [
31-
'warn',
32-
{ allowConstantExport: true },
98+
args: "all",
99+
argsIgnorePattern: "^_",
100+
caughtErrors: "all",
101+
caughtErrorsIgnorePattern: "^_",
102+
destructuredArrayIgnorePattern: "^_",
103+
varsIgnorePattern: "^_",
104+
ignoreRestSiblings: true,
105+
},
33106
],
34107
},
35108
},
36-
)
109+
];

0 commit comments

Comments
 (0)