Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"overrides": [
{
"extends": ["plugin:jsonc/recommended-with-jsonc"],
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"jsonc/sort-keys": ["warn"]
}
},
{
"extends": ["plugin:jsonc/recommended-with-jsonc"],
"files": ["package.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"jsonc/sort-keys": [
"warn",
{
"hasProperties": ["type"],
"order": [
"$schema",
"name",
"version",
"private",
"description",
"license",
"author",
"maintainers",
"contributors",
"homepage",
"repository",
"bugs",
"type",
"exports",
"main",
"module",
"browser",
"man",
"preferGlobal",
"bin",
"files",
"directories",
"scripts",
"config",
"sideEffects",
"types",
"typings",
"workspaces",
"resolutions",
"dependencies",
"bundleDependencies",
"bundledDependencies",
"peerDependencies",
"peerDependenciesMeta",
"optionalDependencies",
"devDependencies",
"keywords",
"engines",
"engineStrict",
"os",
"cpu",
"publishConfig"
],
"pathPattern": "^$"
},
{
"order": { "type": "asc" },
"pathPattern": "^(?!exports\\[).*"
}
]
}
},
{
"extends": ["./first-gen/.eslintrc.json"],
"files": ["first-gen/**/*"]
},
{
"extends": ["./second-gen/.eslintrc.json"],
"files": ["second-gen/**/*"]
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"root": true,
"rules": {
"no-console": [
"error",
{
"allow": ["warn", "error"]
}
],
"no-debugger": 2
}
}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ jobs:
level: error
reporter: github-pr-review
filter_mode: diff_context
eslint_flags: '${{ needs.changed_files.outputs.eslint_added_files }} ${{ needs.changed_files.outputs.eslint_modified_files }}'
eslint_flags: '--config .eslintrc.json ${{ needs.changed_files.outputs.eslint_added_files }} ${{ needs.changed_files.outputs.eslint_modified_files }}'
2 changes: 1 addition & 1 deletion first-gen/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
Expand Down
17 changes: 15 additions & 2 deletions first-gen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"scripts": {
"analyze": "lit-analyzer \"{packages,tools}/*/src/**/!(*.css).ts\"",
"build": "wireit",
"prebuild": "wireit",
"build:clear-cache": "rimraf packages/*/tsconfig.tsbuildinfo && rimraf tools/*/tsconfig.tsbuildinfo",
"build:confirm": "node ./scripts/confirm-build.js",
"build:css": "wireit",
Expand Down Expand Up @@ -62,7 +63,8 @@
"process-icons": "wireit",
"publish:react": "yarn changeset publish --no-git-tag --tag latest --no-push",
"push-to-remote": "git add . && git commit -m \"chore: release new versions #publish\" && git push",
"start": "yarn storybook",
"dev:core": "yarn workspace @swc/core dev",
"start": "run-p dev:core storybook",
"storybook": "wireit",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would start also require yarn run dev on core?

"storybook:build": "NODE_ENV=production storybook build -o projects/documentation/dist/storybook -c storybook",
"storybook:quick": "run-p build:watch storybook:run",
Expand All @@ -82,7 +84,7 @@
"test:visual:clean:current": "rimraf test/visual/screenshots-current",
"test:watch": "yarn test:watch:focus unit",
"test:watch:flags:focus": "yarn build && run-p build:watch \"test:start --watch --group {1} --config web-test-runner.config.ci-chromium-flags.js\" --",
"test:watch:focus": "yarn build && run-p build:watch \"test:start --watch --group {1}\" --",
"test:watch:focus": "yarn dev:core & yarn build && run-p build:watch \"test:start --watch --group {1}\" --",
"version:update": "genversion --verbose --semi --esm ./tools/base/src/version.js",
"vrt:preview": "yarn wds --config test/visual/wds-vrt.config.js"
},
Expand Down Expand Up @@ -221,10 +223,21 @@
"wireit": {
"build": {
"dependencies": [
"prebuild",
"build:ts",
"build:types"
]
},
"prebuild": {
"command": "yarn workspace @swc/core build",
"files": [
"../second-gen/packages/core/components/**/*",
"../second-gen/packages/core/shared/**/*",
"../second-gen/packages/core/package.json",
"../second-gen/packages/core/vite.config.js",
"../second-gen/packages/core/tsconfig.json"
]
},
"build:css": {
"clean": "if-file-deleted",
"command": "node ./scripts/build-css.js",
Expand Down
36 changes: 22 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@
},
"type": "module",
"scripts": {
"build": "yarn workspace @adobe/spectrum-web-components build",
"test": "yarn workspace @adobe/spectrum-web-components test",
"start": "yarn workspace @adobe/spectrum-web-components storybook",
"lint": "yarn workspace @adobe/spectrum-web-components lint",
"postinstall": "husky || true && patch-package"
"build": "yarn build:first-gen && yarn build:second-gen",
"build:first-gen": "yarn workspace @adobe/spectrum-web-components build",
"build:second-gen": "yarn workspace @adobe/swc build",
"lint": "yarn lint:first-gen && yarn lint:second-gen",
"lint:first-gen": "yarn workspace @adobe/spectrum-web-components lint",
"lint:second-gen": "yarn workspace @adobe/swc lint",
"postinstall": "husky || true && patch-package",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need patch-package? we can patch packages with yarn4 now and have removed patch-package from first gen to my knowledge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great question but this is out of scope for the current PR. will track it on slack maybe?

"start": "yarn start:first-gen & yarn start:second-gen",
Copy link
Contributor

@caseyisonit caseyisonit Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running yarn start from the root directory, second-gen fails but first-gen will run. Screenshot of the error:
Screenshot 2025-10-23 at 3 34 19 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reason prestorybook hook was not getting called and thus this error.
i chained prestorybook explicitly to run before storybook in second-gen packages and it's working now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was still getting the same error associated with storybook setup not having dirname correctly defined since we are using modules. i have implemented a fix and will push it up with my review.

"start:first-gen": "yarn workspace @adobe/spectrum-web-components start",
"start:second-gen": "yarn workspace @adobe/swc start",
"test": "yarn test:first-gen & yarn test:second-gen",
"test:first-gen": "yarn workspace @adobe/spectrum-web-components test",
"test:second-gen": "yarn workspace @adobe/swc test"
},
"workspaces": [
"first-gen",
Expand All @@ -32,6 +40,15 @@
"resolutions": {
"playwright": "1.53.1"
},
"devDependencies": {
"@changesets/cli": "2.29.7",
"@commitlint/cli": "19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"husky": "9.1.7",
"lint-staged": "^16.1.2",
"patch-package": "^8.0.0",
"replace-in-file": "^8.3.0"
},
"keywords": [
"design-system",
"spectrum",
Expand All @@ -42,15 +59,6 @@
"lit-element",
"lit-html"
],
"devDependencies": {
"@changesets/cli": "2.29.7",
"@commitlint/cli": "19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"husky": "9.1.7",
"lint-staged": "^16.1.2",
"patch-package": "^8.0.0",
"replace-in-file": "^8.3.0"
},
"engines": {
"node": ">=20.10.0",
"yarn": ">=4.6.0"
Expand Down
9 changes: 1 addition & 8 deletions second-gen/.eslintrc.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make sure to review the linter settings we want in second-gen to ensure they are patterns we want to continue using or add new ones? This is not blocking for this PR but want to make sure we discuss as a team

cc @rubencarvalho @graynorton

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What currently is here is just a simple setup to get eslinting up and running. We can and should talk about it :)

Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
Expand Down Expand Up @@ -143,13 +143,6 @@
}
],
"no-debugger": 2,
"notice/notice": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to make sure this is still working in second gen, we should still be prepending a copywright to every file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the root level work across the project?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it cause we don't have a license.js config for second-gen and i don't know if we want to replicate the first-gen or not?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do, yes. License should be project-wide

"error",
{
"mustMatch": "Copyright [0-9]{0,4} Adobe. All rights reserved.",
"templateFile": "first-gen/config/license.js"
}
],
"simple-import-sort/imports": [
"error",
{
Expand Down
9 changes: 5 additions & 4 deletions second-gen/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@adobe/spectrum-web-components-2nd-gen",
"name": "@adobe/swc",
"version": "0.0.1",
"private": true,
"description": "Second generation Spectrum Web Components with modern tooling and architecture",
Expand All @@ -16,17 +16,18 @@
},
"type": "module",
"scripts": {
"build": "yarn workspaces foreach --from '@swc/*' run build",
"clean": "yarn workspaces foreach --from '@swc/*' run clean",
"build": "yarn workspaces foreach --from '@swc/*' --recursive run build",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will force Yarn to traverse downstream dependents, rebuilding or cleaning even when nothing changed. Is this what we need? We can do caching or parallelisation here too. Let me know your setup

"clean": "yarn workspaces foreach --from '@swc/*' --recursive run clean",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you just want to delete the SWC output you can avoid the cascading clean. You can just run this?

yarn workspaces foreach --from '@swc/*' run clean

"lint": "eslint . --ext .ts,.js,.json",
"storybook": "yarn workspace @swc/components storybook",
"start": "yarn workspace @swc/core dev & yarn workspace @swc/components cem:watch & yarn workspace @swc/components storybook",
"storybook:build": "yarn workspace @swc/components storybook:build",
"test": "yarn workspace @swc/components test"
},
"workspaces": [
"packages/*"
],
"devDependencies": {
"eslint": "8.57.1",
"eslint-plugin-simple-import-sort": "^12.1.1"
},
"keywords": [
Expand Down
14 changes: 8 additions & 6 deletions second-gen/packages/swc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
"author": "Adobe",
"homepage": "https://opensource.adobe.com/spectrum-web-components/",
"repository": {
"directory": "second-gen/packages/swc",
"type": "git",
"url": "https://github.com/adobe/spectrum-web-components.git",
"directory": "second-gen/packages/swc"
"url": "https://github.com/adobe/spectrum-web-components.git"
},
"bugs": {
"url": "https://github.com/adobe/spectrum-web-components/issues"
},
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
Expand All @@ -30,20 +28,24 @@
"import": "./dist/components/*/index.js"
}
},
"main": "./dist/index.js",
"files": [
"dist/"
],
"scripts": {
"analyze": "cem analyze --config cem.config.js",
"build": "vite build",
"cem:watch": "cem analyze --watch",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, for consistency, could we do analyze:watch?

"clean": "rimraf dist",
"dev": "vite build --watch",
"storybook": "yarn analyze && storybook dev -p 6006",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn cem:watch && storybook dev -p 6006?

"storybook:build": "yarn analyze && storybook build",
"test": "vitest",
"test": "vitest --run",
"test:coverage": "vitest --coverage",
"test:ui": "vitest --ui"
"test:ui": "vitest --ui",
"test:watch": "yarn workspace @swc/core dev & vitest"
},
"types": "./dist/index.d.ts",
"dependencies": {
"@swc/core": "workspace:*",
"lit": "^2.5.0 || ^3.1.3"
Expand Down
17 changes: 9 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,6 @@ __metadata:
languageName: node
linkType: hard

"@adobe/spectrum-web-components-2nd-gen@workspace:second-gen":
version: 0.0.0-use.local
resolution: "@adobe/spectrum-web-components-2nd-gen@workspace:second-gen"
dependencies:
eslint-plugin-simple-import-sort: "npm:^12.1.1"
languageName: unknown
linkType: soft

"@adobe/spectrum-web-components-monorepo@workspace:.":
version: 0.0.0-use.local
resolution: "@adobe/spectrum-web-components-monorepo@workspace:."
Expand Down Expand Up @@ -308,6 +300,15 @@ __metadata:
languageName: unknown
linkType: soft

"@adobe/swc@workspace:second-gen":
version: 0.0.0-use.local
resolution: "@adobe/swc@workspace:second-gen"
dependencies:
eslint: "npm:8.57.1"
eslint-plugin-simple-import-sort: "npm:^12.1.1"
languageName: unknown
linkType: soft

"@ampproject/remapping@npm:^2.3.0":
version: 2.3.0
resolution: "@ampproject/remapping@npm:2.3.0"
Expand Down
Loading