diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bbc585e1..7593c17a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,6 +12,7 @@ on: options: - components - tokens + - linting version_bump: description: Version bump required: true diff --git a/package.json b/package.json index f16557fe..80945f4d 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "devDependencies": { "@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/parser": "^6.2.0", - "eslint": "^8.46.0", + "eslint": "^8.54.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-sort-imports-es6-autofix": "^0.6.0", "eslint-plugin-tsdoc": "^0.2.17", diff --git a/packages/components/src/App.tsx b/packages/components/src/App.tsx index edf4c446..23b96ae2 100644 --- a/packages/components/src/App.tsx +++ b/packages/components/src/App.tsx @@ -31,9 +31,9 @@ export const webStorybookColorScheme = () => { if (colorScheme !== 'light' && colorScheme !== 'dark') { return null } - + return colorScheme - } + }, ) } diff --git a/packages/linting/.gitkeep b/packages/linting/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/linting/LICENSE b/packages/linting/LICENSE new file mode 100644 index 00000000..16af8ea9 --- /dev/null +++ b/packages/linting/LICENSE @@ -0,0 +1,5 @@ +Copyright 2023 Department of Veterans Affairs + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/packages/linting/README.md b/packages/linting/README.md new file mode 100644 index 00000000..1bcb7bf3 --- /dev/null +++ b/packages/linting/README.md @@ -0,0 +1,9 @@ +# VA Design System Mobile ESLint Configuration + +This package contains an ESLint config for use by consumers of the [VA Design System Mobile Component Library](https://www.npmjs.com/package/@department-of-veterans-affairs/mobile-component-library) to automatically issue deprecation notices when outdated components are being used. + +## Getting Started +These steps assume you already have `eslint` installed for your project as a devDependency and configured correctly. +1. Add `eslint-plugin-deprecate` as a devDependency to your project (peerDependency of package) +2. Add `@department-of-veterans-affairs/eslint-config-mobile` as a devDependency to your project +3. In your eslint config file, add to the `extends` attribute: `@department-of-veterans-affairs/mobile` \ No newline at end of file diff --git a/packages/linting/index.js b/packages/linting/index.js new file mode 100644 index 00000000..007ee090 --- /dev/null +++ b/packages/linting/index.js @@ -0,0 +1,13 @@ +module.exports = { + plugins: ['deprecate'], + rules: { + 'deprecate/import': [ + 'warn', + { + name: 'VAButton', + module: 'components', + use: 'Button from @department-of-veterans-affairs/mobile-component-library', + }, + ], + }, +} diff --git a/packages/linting/package.json b/packages/linting/package.json new file mode 100644 index 00000000..5557443e --- /dev/null +++ b/packages/linting/package.json @@ -0,0 +1,35 @@ +{ + "name": "@department-of-veterans-affairs/eslint-config-mobile", + "version": "0.2.0-alpha.1", + "description": "VA Design System Mobile ESLint Configuration", + "repository": { + "type": "git", + "url": "git+https://github.com/department-of-veterans-affairs/va-mobile-library.git" + }, + "keywords": [ + "design", + "system", + "library", + "eslint", + "eslintConfig", + "linter", + "linting" + ], + "maintainers": [ + "@department-of-veterans-affairs/flagship-mobile-platform" + ], + "license": "ISC", + "bugs": { + "url": "https://github.com/department-of-veterans-affairs/va-mobile-library/issues" + }, + "homepage": "https://github.com/department-of-veterans-affairs/va-mobile-library#readme", + "dependencies": { + "eslint-plugin-deprecate": "^0.8.4" + }, + "peerDependencies": { + "eslint": ">= 8" + }, + "devDependencies": { + "eslint": "^8.54.0" + } +} diff --git a/yarn.lock b/yarn.lock index 6579eade..5de59c8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2683,13 +2683,24 @@ __metadata: languageName: node linkType: hard +"@department-of-veterans-affairs/eslint-config-mobile@workspace:packages/linting": + version: 0.0.0-use.local + resolution: "@department-of-veterans-affairs/eslint-config-mobile@workspace:packages/linting" + dependencies: + eslint: ^8.54.0 + eslint-plugin-deprecate: ^0.8.4 + peerDependencies: + eslint: ">= 8" + languageName: unknown + linkType: soft + "@department-of-veterans-affairs/mobile-component-library-monorepo@workspace:.": version: 0.0.0-use.local resolution: "@department-of-veterans-affairs/mobile-component-library-monorepo@workspace:." dependencies: "@typescript-eslint/eslint-plugin": ^6.2.0 "@typescript-eslint/parser": ^6.2.0 - eslint: ^8.46.0 + eslint: ^8.54.0 eslint-config-prettier: ^9.0.0 eslint-plugin-sort-imports-es6-autofix: ^0.6.0 eslint-plugin-tsdoc: ^0.2.17 @@ -2848,9 +2859,9 @@ __metadata: languageName: node linkType: hard -"@eslint/eslintrc@npm:^2.1.1": - version: 2.1.1 - resolution: "@eslint/eslintrc@npm:2.1.1" +"@eslint/eslintrc@npm:^2.1.3": + version: 2.1.3 + resolution: "@eslint/eslintrc@npm:2.1.3" dependencies: ajv: ^6.12.4 debug: ^4.3.2 @@ -2861,14 +2872,14 @@ __metadata: js-yaml: ^4.1.0 minimatch: ^3.1.2 strip-json-comments: ^3.1.1 - checksum: bf909ea183d27238c257a82d4ffdec38ca94b906b4b8dfae02ecbe7ecc9e5a8182ef5e469c808bb8cb4fea4750f43ac4ca7c4b4a167b6cd7e3aaacd386b2bd25 + checksum: 5c6c3878192fe0ddffa9aff08b4e2f3bcc8f1c10d6449b7295a5f58b662019896deabfc19890455ffd7e60a5bd28d25d0eaefb2f78b2d230aae3879af92b89e5 languageName: node linkType: hard -"@eslint/js@npm:^8.46.0": - version: 8.46.0 - resolution: "@eslint/js@npm:8.46.0" - checksum: 7aed479832302882faf5bec37e9d068f270f84c19b3fb529646a7c1b031e73a312f730569c78806492bc09cfce3d7651dfab4ce09a56cbb06bc6469449e56377 +"@eslint/js@npm:8.54.0": + version: 8.54.0 + resolution: "@eslint/js@npm:8.54.0" + checksum: 6d88a6f711ef0133566b5340e3178a178fbb297585766460f195d0a9db85688f1e5cf8559fd5748aeb3131e2096c66595b323d8edab22df015acda68f1ebde92 languageName: node linkType: hard @@ -3389,14 +3400,14 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.11.10": - version: 0.11.10 - resolution: "@humanwhocodes/config-array@npm:0.11.10" +"@humanwhocodes/config-array@npm:^0.11.13": + version: 0.11.13 + resolution: "@humanwhocodes/config-array@npm:0.11.13" dependencies: - "@humanwhocodes/object-schema": ^1.2.1 + "@humanwhocodes/object-schema": ^2.0.1 debug: ^4.1.1 minimatch: ^3.0.5 - checksum: 1b1302e2403d0e35bc43e66d67a2b36b0ad1119efc704b5faff68c41f791a052355b010fb2d27ef022670f550de24cd6d08d5ecf0821c16326b7dcd0ee5d5d8a + checksum: f8ea57b0d7ed7f2d64cd3944654976829d9da91c04d9c860e18804729a33f7681f78166ef4c761850b8c324d362f7d53f14c5c44907a6b38b32c703ff85e4805 languageName: node linkType: hard @@ -3407,10 +3418,10 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/object-schema@npm:^1.2.1": - version: 1.2.1 - resolution: "@humanwhocodes/object-schema@npm:1.2.1" - checksum: a824a1ec31591231e4bad5787641f59e9633827d0a2eaae131a288d33c9ef0290bd16fda8da6f7c0fcb014147865d12118df10db57f27f41e20da92369fcb3f1 +"@humanwhocodes/object-schema@npm:^2.0.1": + version: 2.0.1 + resolution: "@humanwhocodes/object-schema@npm:2.0.1" + checksum: 24929487b1ed48795d2f08346a0116cc5ee4634848bce64161fb947109352c562310fd159fc64dda0e8b853307f5794605191a9547f7341158559ca3c8262a45 languageName: node linkType: hard @@ -7330,6 +7341,13 @@ __metadata: languageName: node linkType: hard +"@ungap/structured-clone@npm:^1.2.0": + version: 1.2.0 + resolution: "@ungap/structured-clone@npm:1.2.0" + checksum: 4f656b7b4672f2ce6e272f2427d8b0824ed11546a601d8d5412b9d7704e83db38a8d9f402ecdf2b9063fc164af842ad0ec4a55819f621ed7e7ea4d1efcc74524 + languageName: node + linkType: hard + "@urql/core@npm:2.3.6": version: 2.3.6 resolution: "@urql/core@npm:2.3.6" @@ -11696,6 +11714,15 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-deprecate@npm:^0.8.4": + version: 0.8.4 + resolution: "eslint-plugin-deprecate@npm:0.8.4" + peerDependencies: + eslint: ">=2.x" + checksum: 07f3588b12a76b3f3e1761e023b54e41846f65e89f7a87b572762233015ff1198c4f7bee6f0fa70fec150c774059c9d83828299e0d27d844f858ad353a82d92e + languageName: node + linkType: hard + "eslint-plugin-sort-imports-es6-autofix@npm:^0.6.0": version: 0.6.0 resolution: "eslint-plugin-sort-imports-es6-autofix@npm:0.6.0" @@ -11745,24 +11772,32 @@ __metadata: languageName: node linkType: hard -"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1, eslint-visitor-keys@npm:^3.4.2": +"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1": version: 3.4.2 resolution: "eslint-visitor-keys@npm:3.4.2" checksum: 9e0e7e4aaea705c097ae37c97410e5f167d4d2193be2edcb1f0760762ede3df01545e4820ae314f42dcec687745f2c6dcaf6d83575c4a2a241eb0c8517d724f2 languageName: node linkType: hard -"eslint@npm:^8.46.0": - version: 8.46.0 - resolution: "eslint@npm:8.46.0" +"eslint-visitor-keys@npm:^3.4.3": + version: 3.4.3 + resolution: "eslint-visitor-keys@npm:3.4.3" + checksum: 36e9ef87fca698b6fd7ca5ca35d7b2b6eeaaf106572e2f7fd31c12d3bfdaccdb587bba6d3621067e5aece31c8c3a348b93922ab8f7b2cbc6aaab5e1d89040c60 + languageName: node + linkType: hard + +"eslint@npm:^8.54.0": + version: 8.54.0 + resolution: "eslint@npm:8.54.0" dependencies: "@eslint-community/eslint-utils": ^4.2.0 "@eslint-community/regexpp": ^4.6.1 - "@eslint/eslintrc": ^2.1.1 - "@eslint/js": ^8.46.0 - "@humanwhocodes/config-array": ^0.11.10 + "@eslint/eslintrc": ^2.1.3 + "@eslint/js": 8.54.0 + "@humanwhocodes/config-array": ^0.11.13 "@humanwhocodes/module-importer": ^1.0.1 "@nodelib/fs.walk": ^1.2.8 + "@ungap/structured-clone": ^1.2.0 ajv: ^6.12.4 chalk: ^4.0.0 cross-spawn: ^7.0.2 @@ -11770,7 +11805,7 @@ __metadata: doctrine: ^3.0.0 escape-string-regexp: ^4.0.0 eslint-scope: ^7.2.2 - eslint-visitor-keys: ^3.4.2 + eslint-visitor-keys: ^3.4.3 espree: ^9.6.1 esquery: ^1.4.2 esutils: ^2.0.2 @@ -11795,7 +11830,7 @@ __metadata: text-table: ^0.2.0 bin: eslint: bin/eslint.js - checksum: 7a7d36b1a3bbc12e08fbb5bc36fd482a7a5a1797e62e762499dd45601b9e45aaa53a129f31ce0b4444551a9639b8b681ad535f379893dd1e3ae37b31dccd82aa + checksum: 7e876e9da2a18a017271cf3733d05a3dfbbe469272d75753408c6ea5b1646c71c6bb18cb91e10ca930144c32c1ce3701e222f1ae6784a3975a69f8f8aa68e49f languageName: node linkType: hard