diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000000..8b83dea584 --- /dev/null +++ b/.eslintrc.json @@ -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": 2020, + "sourceType": "module" + }, + "plugins": ["@typescript-eslint"], + "root": true, + "rules": { + "no-console": [ + "error", + { + "allow": ["warn", "error"] + } + ], + "no-debugger": 2 + } +} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a2176b65a7..914016401d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 }}' diff --git a/first-gen/package.json b/first-gen/package.json index 0dd61c2951..2b711c9449 100644 --- a/first-gen/package.json +++ b/first-gen/package.json @@ -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", @@ -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", "storybook:build": "NODE_ENV=production storybook build -o projects/documentation/dist/storybook -c storybook", "storybook:quick": "run-p build:watch storybook:run", @@ -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" }, @@ -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", diff --git a/package.json b/package.json index 36a5b52186..bec12a5687 100644 --- a/package.json +++ b/package.json @@ -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:*", + "build:first-gen": "yarn workspace @adobe/spectrum-web-components build", + "build:second-gen": "yarn workspace @adobe/swc build", + "lint": "yarn lint:*", + "lint:first-gen": "yarn workspace @adobe/spectrum-web-components lint", + "lint:second-gen": "yarn workspace @adobe/swc lint", + "postinstall": "husky || true && patch-package", + "start": "yarn start:*", + "start:first-gen": "yarn workspace @adobe/spectrum-web-components start", + "start:second-gen": "yarn workspace @adobe/swc start", + "test": "yarn test:*", + "test:first-gen": "yarn workspace @adobe/spectrum-web-components test", + "test:second-gen": "yarn workspace @adobe/swc test" }, "workspaces": [ "first-gen", @@ -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", @@ -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", "yarn": ">=4.6.0" diff --git a/second-gen/package.json b/second-gen/package.json index 9698a3e147..f6036b2de2 100644 --- a/second-gen/package.json +++ b/second-gen/package.json @@ -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", @@ -16,10 +16,10 @@ }, "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", + "clean": "yarn workspaces foreach --from '@swc/*' --recursive 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" }, diff --git a/second-gen/packages/swc/components/progress-circle/ProgressCircle.ts b/second-gen/packages/swc/components/progress-circle/ProgressCircle.ts index e4e0eff7a9..3ef202ba6b 100644 --- a/second-gen/packages/swc/components/progress-circle/ProgressCircle.ts +++ b/second-gen/packages/swc/components/progress-circle/ProgressCircle.ts @@ -11,10 +11,10 @@ */ import { CSSResultArray, html, TemplateResult } from 'lit'; +import { property } from 'lit/decorators.js'; import { classMap } from 'lit/directives/class-map.js'; import { ProgressCircleBase } from '@swc/core/components/progress-circle'; -import { property } from '@spectrum-web-components/base/src/decorators.js'; import progressCircleStyles from './progress-circle.css'; diff --git a/second-gen/packages/swc/package.json b/second-gen/packages/swc/package.json index 34d427a3ef..a09ee9139b 100644 --- a/second-gen/packages/swc/package.json +++ b/second-gen/packages/swc/package.json @@ -35,11 +35,13 @@ ], "scripts": { "build": "vite build", + "cem:watch": "cem analyze --watch", "clean": "rimraf dist", "dev": "vite build --watch", + "prestorybook": "cem analyze", "storybook": "storybook dev -p 6006", "storybook:build": "storybook build", - "test": "vitest", + "test": "yarn workspace @swc/core dev & vitest", "test:coverage": "vitest --coverage", "test:ui": "vitest --ui" }, @@ -87,5 +89,5 @@ "engines": { "node": ">=20" }, - "customElements": ".storybook/custom-elements.json" + "customElements": "custom-elements.json" } diff --git a/yarn.lock b/yarn.lock index 6587e190aa..1c93f13288 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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:." @@ -308,6 +300,14 @@ __metadata: languageName: unknown linkType: soft +"@adobe/swc@workspace:second-gen": + version: 0.0.0-use.local + resolution: "@adobe/swc@workspace:second-gen" + dependencies: + 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"