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..89d878f940 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", @@ -221,10 +222,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..e7caafde19 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,18 @@ }, "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", + "build-first-gen": "yarn workspace @adobe/spectrum-web-components build", + "build-second-gen": "yarn workspace @adobe/swc build", + "build": "yarn build-first-gen && yarn build-second-gen", + "test-first-gen": "yarn workspace @adobe/spectrum-web-components test", + "test-second-gen": "yarn workspace @adobe/swc test", + "test": "yarn test-first-gen && yarn test-second-gen", + "start-first-gen": "yarn workspace @adobe/spectrum-web-components start", + "start-second-gen": "yarn workspace @adobe/swc start", + "start": "yarn start-first-gen & yarn start-second-gen", + "lint-first-gen": "yarn workspace @adobe/spectrum-web-components lint", + "lint-second-gen": "yarn workspace @adobe/swc lint", + "lint": "yarn lint-first-gen & yarn lint-second-gen", "postinstall": "husky || true && patch-package" }, "workspaces": [ diff --git a/second-gen/package.json b/second-gen/package.json index 9698a3e147..b1129fdd45 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/components storybook", "storybook:build": "yarn workspace @swc/components storybook:build", "test": "yarn workspace @swc/components test" }, 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"