Skip to content

Commit 3ac5f11

Browse files
authored
botonic Developer Experience (DX) 3/3 (#1602)
* chore(dx): upgrade eslint_d to 10.1.3 otherwise, --config is ignored * chore(dx): npm7 required to publish hidden files * chore(dx): fix parserOptions.project error in eslint it happens if eslint typescript parser gets the includes files from tsconfig from the dx/base-line folder instead of the main project Now js & json in root folder only prettified and not eslinted, since they're actually not code but config. This also prevents * chore(dx): don't eslint JS files Temporary removed. See README.md * chore: upgrade deprecated babel plugin babel-plugin-add-module-exports->@babel/plugin-transform-modules-commonjs * chore: upgrade dev deps use caret to automatically upgrade minor versions
1 parent 713e914 commit 3ac5f11

File tree

10 files changed

+541
-93
lines changed

10 files changed

+541
-93
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ packages/botonic-cli/botonic-tmp*
2424
.botonic.json
2525
.vscode
2626
docs/website/package-lock.json
27-
tsconfig.tsbuildinfo
27+
*.tsbuildinfo

package-lock.json

+502-77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"@types/jest": "^26.0.23",
55
"@types/node": "^15.3.0",
66
"@types/rimraf": "^3.0.0",
7-
"@typescript-eslint/eslint-plugin": "~4.26.0",
8-
"@typescript-eslint/parser": "~4.25.0",
7+
"@typescript-eslint/eslint-plugin": "^4.26.0",
8+
"@typescript-eslint/parser": "^4.26.0",
99
"babel-eslint": "^10.1.0",
1010
"cloc": "^2.7.0",
1111
"eslint": "^7.26.0",

packages/babel.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = {
1717
plugins: [
1818
require('@babel/plugin-proposal-object-rest-spread'),
1919
require('@babel/plugin-proposal-class-properties'),
20-
require('babel-plugin-add-module-exports'),
20+
require('@babel/plugin-transform-modules-commonjs'),
2121
require('@babel/plugin-transform-runtime')
2222
]
2323
}

packages/botonic-dx/README.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ npm install -D @botonic/dx
1818
```
1919
* Copy the contents of the `sample-config` folder to the root of your project
2020
(Merge this package.json's scripts into your project ones)
21-
* These files just import the configuration maintained within this project.
21+
* The files at `sample-config` just import the configuration maintained within this project.
2222
To adapt them to your project needs, you just need to patch the specific options after importing the baseline.
2323
See instructions on each of these files.
2424

@@ -72,3 +72,16 @@ there are no modifications in git files.
7272
## npm
7373
This package must be published with npm 7.
7474
With v6, there's no way to install hidden files (required for sample-config files)
75+
However, looks like "engines" restriction does not work. Also, npm 7 still has issues
76+
with our monorepo (hangs and spurious errors).
77+
78+
### How to deploy with npm7
79+
So, so far it's recommended to:
80+
* Leave npm 6 globally installed
81+
* Install npm 7 locally in an empty project (`cd <project_with_npm7> && npm init && npm i npm`)
82+
* `cd botonic/packages/botonic-dx && <project_with_npm7>/node_modules/.bin/npm publish`
83+
84+
85+
# Future work
86+
.js files not yet processed with eslint because some rules require the typescript parser,
87+
which runs only on .ts files. It will be fixed by applying these rules only to .ts files.

packages/botonic-dx/package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@botonic/dx",
3-
"version": "0.19.0-alpha.9",
3+
"version": "0.19.0-alpha.16",
44
"description": "Continuous integration for botonic packages",
55
"scripts": {},
66
"author": "",
@@ -22,7 +22,8 @@
2222
"@types/node": "^15.12.1",
2323
"@typescript-eslint/eslint-plugin": "*",
2424
"babel-eslint": "^10.1.0",
25-
"eslint": "^7.25.0",
25+
"eslint": "^7.28.0",
26+
"eslint_d": "^10.1.3",
2627
"eslint-config-prettier": "^7.2.0",
2728
"eslint-import-resolver-typescript": "^2.4.0",
2829
"eslint-plugin-filenames": "*",
@@ -35,21 +36,22 @@
3536
"eslint-plugin-react": "*",
3637
"eslint-plugin-react-hooks": "*",
3738
"eslint-plugin-simple-import-sort": "*",
38-
"eslint_d": "^10.0.4",
3939
"identity-obj-proxy": "^3.0.0",
4040
"jest": "^26.6.3",
4141
"jest-each": "^26.6.2",
4242
"jest-junit": "^12.0.0",
4343
"prettier": "^2.2.1",
44-
"ts-jest": "^26.5.5",
44+
"ts-jest": "^26.5.6",
4545
"ts-mockito": "^2.6.1",
4646
"ts-node": "^9.1.1",
4747
"tslib": "^2.2.0",
4848
"typescript": "^4.2.4"
4949
},
50+
"engines": {
51+
"npm": ">=17.13.0"
52+
},
5053
"files": [
5154
"README.md",
52-
"baseline/.eslintrc*.js",
5355
"baseline/README.md",
5456
"baseline/babel.config.js",
5557
"baseline/jest.config.js",

packages/botonic-dx/sample-config/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"########## LINT": "",
88
"lint": "npm run lint-core -- --fix && npm run prettier",
99
"lint-ci": "npm run lint-core -- -c .eslintrc-ci.js && npm run prettier",
10-
"lint-core": "eslint_d --cache --quiet '*.md' './*.js' '*.js{,on}' '{src,tests}/**/*.[jt]{s,sx}'",
11-
"prettier": "prettier --no-error-on-unmatched-pattern --write '**/*.md' '**/*.css' ",
10+
"lint-core": "eslint_d --cache --quiet '{src,tests}/**/*.[t]{s,sx}'",
11+
"prettier": "prettier --no-error-on-unmatched-pattern --write '**/*.md' '**/*.css' '.*.js' '*.js{,on}'",
1212

1313
"########## DEBUG": "",
1414
"test": "jest",
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
{
22
"extends": "@botonic/dx/baseline/tsconfig.eslint.json",
3+
// include required to avoid this error (probably otherwise it uses baseline as root folder)
4+
// Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
5+
// The file does not match your project config
6+
"include": [
7+
"src",
8+
"tests"
9+
]
310
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"extends": "@botonic/dx/baseline/tsconfig.tests.json",
33
"include": [
4-
"src"
4+
"src",
5+
"tests"
56
],
67
"compilerOptions": {
7-
"rootDir": "src",
8+
"rootDir": ".",
89
}
910
}

packages/botonic-eslint-config/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"typescript"
1515
],
1616
"dependencies": {
17-
"@typescript-eslint/parser": "~4.24.0"
17+
"@typescript-eslint/parser": "^4.26.0"
1818
},
1919
"peerDependencies": {
20-
"@typescript-eslint/eslint-plugin": "~4.22.0",
20+
"@typescript-eslint/eslint-plugin": "^4.26.0",
2121
"eslint-plugin-filenames": "^1.3.2",
2222
"eslint-plugin-import": "^2.22.1",
2323
"eslint-plugin-jest": "^24.3.6",

0 commit comments

Comments
 (0)