Skip to content

Commit 4065209

Browse files
committed
Configure linting and formatting from repo root
1 parent 6bf092c commit 4065209

12 files changed

Lines changed: 166 additions & 266 deletions

File tree

.github/workflows/UnitTests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,4 @@ jobs:
3939
run: pnpm -r test
4040

4141
- name: "Linting packages"
42-
working-directory: ./packages/generator-widget
43-
run: pnpm -r lint
42+
run: pnpm lint

eslint.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import { defineConfig, globalIgnores } from "eslint/config";
4+
import jest from "eslint-plugin-jest";
5+
import tseslint from "typescript-eslint";
6+
import prettierRecommended from "eslint-plugin-prettier/recommended";
7+
8+
export default defineConfig(
9+
globalIgnores([
10+
"packages/generator-widget/generators/app/templates/**",
11+
"packages/pluggable-widgets-tools/dist/**"
12+
]),
13+
{
14+
files: ["**/*.js", "**/*.mjs"],
15+
ignores: ["packages/release-tools/utils/changelog-parser/changelog.js"],
16+
plugins: { js },
17+
extends: ["js/recommended"],
18+
languageOptions: { globals: globals.node },
19+
rules: {
20+
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }]
21+
}
22+
},
23+
{
24+
files: ["**/*.ts"],
25+
plugins: { tseslint },
26+
extends: ["tseslint/recommended"],
27+
languageOptions: { globals: globals.node },
28+
rules: {
29+
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }]
30+
}
31+
},
32+
{
33+
files: ["**/__mocks__/**/*.js", "**/__tests__/**/*.js", "packages/pluggable-widgets-tools/test-config/**"],
34+
plugins: { jest },
35+
languageOptions: { globals: jest.environments.globals.globals }
36+
},
37+
{ ...prettierRecommended, rules: { "prettier/prettier": process.env.CI ? "error" : "warn" } }
38+
);

package.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,30 @@
33
"engines": {
44
"node": ">=20"
55
},
6+
"private": "true",
7+
"type": "module",
68
"scripts": {
7-
"dev:prepare": "corepack enable && corepack prepare"
9+
"dev:prepare": "corepack enable && corepack prepare",
10+
"lint": "eslint"
811
},
912
"license": "Apache-2.0",
1013
"copyright": "© Mendix Technology BV 2022. All rights reserved.",
1114
"repository": {
1215
"type": "git",
1316
"url": "https://github.com/mendix/widgets-tools.git"
1417
},
15-
"packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800"
18+
"packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800",
19+
"devDependencies": {
20+
"@eslint/js": "^10.0.1",
21+
"@prettier/plugin-xml": "^3.4.2",
22+
"@typescript-eslint/eslint-plugin": "^8.59.0",
23+
"@typescript-eslint/parser": "^8.59.0",
24+
"eslint": "^10.4.0",
25+
"eslint-config-prettier": "^10.1.8",
26+
"eslint-plugin-jest": "^29.15.2",
27+
"eslint-plugin-prettier": "^5.5.5",
28+
"globals": "^17.6.0",
29+
"prettier": "^3.8.3",
30+
"typescript-eslint": "^8.59.3"
31+
}
1632
}

packages/command-tests/eslint.config.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/command-tests/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,20 @@
99
"start": "node commands.js"
1010
},
1111
"devDependencies": {
12-
"@eslint/js": "^10.0.1",
1312
"@mendix/generator-widget": "workspace:*",
1413
"@mendix/pluggable-widgets-tools": "workspace:*",
1514
"@prettier/plugin-xml": "^2.2.0",
1615
"@types/jest-image-snapshot": "^4.3.1",
1716
"@types/node": "^20.14.8",
1817
"@types/shelljs": "^0.10.0",
1918
"@types/xml2js": "^0.4.5",
20-
"@typescript-eslint/eslint-plugin": "^8.59.0",
2119
"async-mutex": "^0.5.0",
2220
"chalk": "^5.6.2",
23-
"eslint": "^10.2.1",
2421
"eslint-config-prettier": "^8.5.0",
25-
"eslint-plugin-prettier": "^4.2.1",
2622
"fs-extra": "^11.3.4",
2723
"globals": "^17.6.0",
2824
"identity-obj-proxy": "^3.0.0",
2925
"peggy": "^1.2.0",
30-
"prettier": "^2.5.1",
3126
"shelljs": "^0.10.0",
3227
"shx": "^0.4.0",
3328
"tree-kill": "^1.2.2",

packages/generator-widget/eslint.config.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/generator-widget/generators/app/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class MxGenerator extends Generator {
171171
projectIgnorePath: this.widget.projectPath.replace(/\.\//g, "")
172172
});
173173
this._copyFile(`commons/eslintrc.${this.widget.isLanguageTS ? "ts" : "js"}.js`, ".eslintrc.js");
174-
this._copyFile("commons/prettier.config.js", "prettier.config.js");
174+
this._copyTemplate("commons/prettier.config.ejs", "prettier.config.js");
175175
this._copyTemplate("commons/.prettierignore", ".prettierignore", {
176176
projectIgnorePath: this.widget.projectPath.replace(/\.\//g, "")
177177
});

packages/generator-widget/generators/app/templates/commons/prettier.config.js renamed to packages/generator-widget/generators/app/templates/commons/prettier.config.ejs

File renamed without changes.

packages/generator-widget/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
"bin": "./bin.js",
1010
"main": "generators/app/index.js",
1111
"scripts": {
12-
"test": "jest --config ./jest.config.js",
13-
"lint": "eslint --config .eslintrc.js --ext .jsx,.js,.ts,.tsx generators/"
12+
"test": "jest --config ./jest.config.js"
1413
},
1514
"files": [
1615
"generators"
@@ -23,12 +22,7 @@
2322
"yeoman-generator": "^8.2.2"
2423
},
2524
"devDependencies": {
26-
"@eslint/js": "^10.0.1",
2725
"ejs": "^5.0.2",
28-
"eslint": "^10.3.0",
29-
"eslint-plugin-prettier": "^5.5.5",
30-
"prettier": "^3.8.3",
31-
"globals": "^17.6.0",
3226
"jest": "^30.3.0"
3327
},
3428
"keywords": [

packages/release-tools/package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@
55
"private": true,
66
"main": "./createRelease.ts",
77
"scripts": {
8-
"lint": "eslint --fix --config .eslintrc.js --ext .jsx,.js,.ts,.tsx",
98
"release:pwt": "ts-node --project ./tsconfig.json ./createRelease.ts pwt",
109
"release:gw": "ts-node --project ./tsconfig.json ./createRelease.ts gw",
1110
"build:release:parser": "peggy -o ./utils/changelog-parser/changelog.js ./utils/changelog-parser/changelog.pegjs"
1211
},
1312
"devDependencies": {
1413
"@types/node": "^16.11.19",
1514
"@types/node-fetch": "2.6.13",
16-
"@typescript-eslint/eslint-plugin": "^8.59.0",
17-
"@typescript-eslint/parser": "^8.59.0",
18-
"eslint": "^10.2.1",
19-
"eslint-config-prettier": "^8.5.0",
20-
"eslint-plugin-prettier": "^4.2.1",
2115
"peggy": "^1.2.0",
22-
"prettier": "^2.5.1",
2316
"typescript": "^4.8.4"
2417
},
2518
"dependencies": {

0 commit comments

Comments
 (0)