Skip to content

Commit 2cbab71

Browse files
committed
chore: add root lint tooling and ci lint job
Add shared repo-level linting once the workspace structure is already in place, rather than mixing formatting policy into the initial monorepo bootstrap. Move the common development tooling to the root manifest to match the dotcom-reliability-kit monorepo pattern, add a root Biome config, and expose a root npm run lint command. Wire that into CircleCI as a separate lint job so test failures and style failures stay distinct in review and in CI output. Clean up scripts/create-consent-csv.js as part of this step so the repo can actually pass the new lint gate. The intent here is to make the lint introduction real, not to weaken the rules or special-case existing files.
1 parent f9c5e67 commit 2cbab71

6 files changed

Lines changed: 286 additions & 28 deletions

File tree

.circleci/config.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,16 @@ jobs:
4242
name: Run repo tests
4343
command: npm test
4444

45+
lint:
46+
<<: *container_config_node
47+
steps:
48+
- *attach_workspace
49+
- run:
50+
name: Run repo linting
51+
command: npm run lint
52+
4553
workflows:
46-
test:
54+
test-and-lint:
4755
jobs:
4856
- install:
4957
name: install-v<< matrix.node-version >>
@@ -57,3 +65,7 @@ workflows:
5765
matrix:
5866
parameters:
5967
node-version: ["26.2", "24.15", "22.22"]
68+
- lint:
69+
name: lint-v24.15
70+
requires:
71+
- install-v24.15

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ npm install
2222

2323
## Commands
2424

25-
Run workspace tests from the repo root:
25+
Run repo checks from the repo root:
2626

2727
```bash
28+
npm run lint
2829
npm test
2930
```
3031

biome.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"extends": ["./node_modules/@dotcom-reliability-kit/biome-config/config.json"],
4+
"formatter": {
5+
"indentStyle": "tab",
6+
"indentWidth": 4,
7+
"lineWidth": 100
8+
},
9+
"linter": {
10+
"rules": {
11+
"suspicious": {
12+
"noExplicitAny": "off"
13+
}
14+
}
15+
},
16+
"javascript": {
17+
"formatter": {
18+
"quoteStyle": "single",
19+
"jsxQuoteStyle": "double",
20+
"trailingCommas": "none"
21+
}
22+
},
23+
"json": {
24+
"formatter": {
25+
"enabled": false
26+
}
27+
}
28+
}

package-lock.json

Lines changed: 207 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "ip-martech-tooling",
33
"version": "0.0.0",
4+
"type": "module",
45
"private": true,
56
"description": "Shareable tooling and common packages for Martech engineers.",
67
"repository": {
@@ -14,8 +15,14 @@
1415
"packages/*"
1516
],
1617
"scripts": {
18+
"lint": "biome check",
1719
"test": "npm run test --workspaces --if-present"
1820
},
21+
"devDependencies": {
22+
"@biomejs/biome": "^2.4.16",
23+
"@dotcom-reliability-kit/biome-config": "^1.0.0",
24+
"typescript": "^5.8.3"
25+
},
1926
"engines": {
2027
"node": "^22.12 || ^24 || ^26"
2128
}

scripts/create-consent-csv.js

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,38 @@ If you want to create files each with 10,000 records:
1717
node ./create-consent-csv.js 10000
1818
*/
1919

20-
const fs = require("fs");
20+
const fs = require('node:fs');
2121
const { v4: uuid } = require('uuid');
2222
const now = new Date();
2323

24+
const log = (message) => {
25+
process.stdout.write(`${message}\n`);
26+
};
27+
2428
const createCsv = (numberOfRows) => {
25-
console.log("Starting process...");
26-
const consentFields =
27-
`marketing-email,accept,${now / 1000},unlimited`;
28-
29-
console.log(`Creating email data. ${numberOfRows} records...`);
30-
31-
const csvEmailData = Array.from(Array(numberOfRows)).map((row) => {
32-
return [(`${now.getDate()}-${now.getMonth()+1}-${uuid()}-test@test.com`)];
33-
});
34-
35-
console.log("Writing to file...");
36-
const fileEmail = fs.createWriteStream("email.csv");
37-
const fileConsent = fs.createWriteStream("consent.csv");
38-
39-
fileEmail.write("email" + "\n");
40-
fileConsent.write("email,category,action,timestamp,valid_until" + "\n");
41-
csvEmailData.forEach(function (v) {
42-
fileEmail.write(v.join(",") + "\n");
43-
fileConsent.write(v.join(",") + ',' + consentFields + "\n");
44-
});
45-
fileEmail.end();
46-
fileConsent.end();
47-
console.log("Completed!!");
29+
log('Starting process...');
30+
const consentFields = `marketing-email,accept,${now / 1000},unlimited`;
31+
32+
log(`Creating email data. ${numberOfRows} records...`);
33+
34+
const csvEmailData = Array.from({ length: numberOfRows }).map(() => {
35+
return [`${now.getDate()}-${now.getMonth() + 1}-${uuid()}-test@test.com`];
36+
});
37+
38+
log('Writing to file...');
39+
const fileEmail = fs.createWriteStream('email.csv');
40+
const fileConsent = fs.createWriteStream('consent.csv');
41+
42+
fileEmail.write('email\n');
43+
fileConsent.write('email,category,action,timestamp,valid_until\n');
44+
csvEmailData.forEach((entry) => {
45+
fileEmail.write(`${entry.join(',')}\n`);
46+
fileConsent.write(`${entry.join(',')},${consentFields}\n`);
47+
});
48+
fileEmail.end();
49+
fileConsent.end();
50+
log('Completed!!');
4851
};
49-
console.log(process.argv[2]);
50-
const count = process.argv[2] ? process.argv[2] : 10;
52+
53+
const count = process.argv[2] ?? 10;
5154
createCsv(+count);

0 commit comments

Comments
 (0)