diff --git a/.eslintrc.json b/.eslintrc.json index 9a3d77e..5c0085f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,21 +7,41 @@ }, "extends": [ "eslint:recommended", + "plugin:n/recommended", "plugin:@typescript-eslint/recommended", + "plugin:import/recommended", + "plugin:import/typescript", "plugin:react/recommended", "plugin:react/jsx-runtime", - "plugin:jsx-a11y/recommended", - "plugin:react-hooks/recommended" + "plugin:react-hooks/recommended", + "plugin:jsx-a11y/recommended" ], "ignorePatterns": ["dist"], - "plugins": ["react", "react-hooks", "jsx-a11y"], + "plugins": ["@typescript-eslint", "import", "react", "react-hooks", "jsx-a11y"], "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2024, + "sourceType": "module" + }, "settings": { + "import/resolver": { + "node": true, + "typescript": true + }, "react": { "version": "detect" } }, "rules": { - "no-console": "error" + "no-console": "error", + "n/no-missing-import": "off", + "n/no-unpublished-import": "off", + "import/order": [ + "error", + { + "groups": ["builtin", "external", "internal", "index", "sibling", "parent", "type"], + "newlines-between": "always" + } + ] } } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39a3c98..b228695 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,9 +27,9 @@ jobs: with: name: npm-debug-log-${{ hashFiles('package-lock.json') }} path: npm-debug.log - - name: Lint - run: npm run lint - name: Build Components run: npm run build -w @busmap/components - name: Build UI run: npm run build -w ui + - name: Lint + run: npm run lint diff --git a/package-lock.json b/package-lock.json index f178fa5..289a0a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,11 +15,14 @@ ], "devDependencies": { "@types/styled-components": "^5.1.26", - "@typescript-eslint/eslint-plugin": "^6.4.1", + "@typescript-eslint/eslint-plugin": "^6.5.0", "@typescript-eslint/parser": "^6.4.1", "babel-plugin-styled-components": "^2.1.4", "eslint": "^8.47.0", + "eslint-import-resolver-typescript": "^3.6.0", + "eslint-plugin-import": "^2.28.1", "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-n": "^16.0.2", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "prettier": "^3.0.1", @@ -6030,6 +6033,12 @@ "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", "dev": true }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, "node_modules/@types/lodash": { "version": "4.14.197", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.197.tgz", @@ -6672,6 +6681,25 @@ "node": ">=8" } }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array.prototype.flat": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", @@ -7189,6 +7217,15 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "dependencies": { + "semver": "^7.0.0" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -8065,6 +8102,19 @@ "once": "^1.4.0" } }, + "node_modules/enhanced-resolve": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/envinfo": { "version": "7.10.0", "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.10.0.tgz", @@ -8380,6 +8430,157 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-typescript": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.0.tgz", + "integrity": "sha512-QTHR9ddNnn35RTxlaEnx2gCxqFlF2SEN0SE2d17SqwyM7YOSI2GHWRYp5BiRkObTUNYPupC/3Fq2a0PpT+EKpg==", + "dev": true, + "dependencies": { + "debug": "^4.3.4", + "enhanced-resolve": "^5.12.0", + "eslint-module-utils": "^2.7.4", + "fast-glob": "^3.3.1", + "get-tsconfig": "^4.5.0", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-es-x": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.2.0.tgz", + "integrity": "sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.1.2", + "@eslint-community/regexpp": "^4.6.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "eslint": ">=8" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.28.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz", + "integrity": "sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.findlastindex": "^1.2.2", + "array.prototype.flat": "^1.3.1", + "array.prototype.flatmap": "^1.3.1", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.7", + "eslint-module-utils": "^2.8.0", + "has": "^1.0.3", + "is-core-module": "^2.13.0", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.6", + "object.groupby": "^1.0.0", + "object.values": "^1.1.6", + "semver": "^6.3.1", + "tsconfig-paths": "^3.14.2" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/eslint-plugin-jsx-a11y": { "version": "6.7.1", "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.7.1.tgz", @@ -8425,6 +8626,31 @@ "semver": "bin/semver.js" } }, + "node_modules/eslint-plugin-n": { + "version": "16.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-16.0.2.tgz", + "integrity": "sha512-Y66uDfUNbBzypsr0kELWrIz+5skicECrLUqlWuXawNSLUq3ltGlCwu6phboYYOTSnoTdHgTLrc+5Ydo6KjzZog==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "builtins": "^5.0.1", + "eslint-plugin-es-x": "^7.1.0", + "ignore": "^5.2.4", + "is-core-module": "^2.12.1", + "minimatch": "^3.1.2", + "resolve": "^1.22.2", + "semver": "^7.5.3" + }, + "engines": { + "node": ">=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-plugin-react": { "version": "7.33.2", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz", @@ -11398,6 +11624,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, "node_modules/object.hasown": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", @@ -13326,6 +13564,15 @@ "node": ">=8" } }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", @@ -13437,6 +13684,15 @@ "integrity": "sha512-AsS729u2RHUfEra9xJrE39peJcc2stq2+poBXX8bcM08Y6g9j/i/PUzwNQqkaJde7Ntg1TO7bSREbR5sdosQ+g==", "dev": true }, + "node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/tar": { "version": "6.1.15", "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.15.tgz", @@ -13706,6 +13962,30 @@ "node": ">=6.10" } }, + "node_modules/tsconfig-paths": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", + "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", diff --git a/package.json b/package.json index c232e86..71cc025 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,14 @@ }, "devDependencies": { "@types/styled-components": "^5.1.26", - "@typescript-eslint/eslint-plugin": "^6.4.1", + "@typescript-eslint/eslint-plugin": "^6.5.0", "@typescript-eslint/parser": "^6.4.1", "babel-plugin-styled-components": "^2.1.4", "eslint": "^8.47.0", + "eslint-import-resolver-typescript": "^3.6.0", + "eslint-plugin-import": "^2.28.1", "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-n": "^16.0.2", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "prettier": "^3.0.1", diff --git a/packages/api/package.json b/packages/api/package.json index 209130f..034d37f 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -7,6 +7,7 @@ "scripts": { "prettier": "prettier -w .", "lint": "eslint . src --ext .ts,.tsx", + "lint:fix": "npm run lint -- --fix", "start": "tsx src/index.ts", "test": "echo \"Error: no test specified\" && exit 1" }, diff --git a/packages/components/package.json b/packages/components/package.json index 0db62e1..bd5903b 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -21,6 +21,7 @@ "scripts": { "prettier": "prettier -w .", "lint": "eslint . src --ext .ts,.tsx", + "lint:fix": "npm run lint -- --fix", "storybook": "storybook dev -p 9000", "build": "duel", "test": "echo \"Error: no test specified\" && exit 1" diff --git a/packages/components/src/autoSuggest/mod.tsx b/packages/components/src/autoSuggest/mod.tsx index c599e29..047caa0 100644 --- a/packages/components/src/autoSuggest/mod.tsx +++ b/packages/components/src/autoSuggest/mod.tsx @@ -4,14 +4,14 @@ import { matchSorter } from 'match-sorter' import debounce from 'lodash.debounce' import styled from 'styled-components' -import type { UseComboboxStateChange, UseComboboxStateChangeTypes } from 'downshift' -import type { ChangeEvent, FC, ReactNode } from 'react' - import { SelectWrap, SelectMenuWrap, SelectMenu, SelectItem } from '../core.js' import { focusedStyles, sizing } from '../styles.js' import { Input } from '../input/mod.js' import { PB40T, SLB30T } from '../colors.js' import { ChevronDown } from '../chevronDown/mod.js' + +import type { ChangeEvent, FC, ReactNode } from 'react' +import type { UseComboboxStateChange, UseComboboxStateChangeTypes } from 'downshift' import type { Size } from '../types.js' interface Item { diff --git a/packages/components/src/autoSuggest/story.tsx b/packages/components/src/autoSuggest/story.tsx index 9a466bc..8d5caf1 100644 --- a/packages/components/src/autoSuggest/story.tsx +++ b/packages/components/src/autoSuggest/story.tsx @@ -1,10 +1,11 @@ import { useCallback, useState } from 'react' import styled from 'styled-components' -import type { StoryFn } from '@storybook/react' -import type { ChangeEvent, FC } from 'react' import { AutoSuggest } from './mod.js' +import type { StoryFn } from '@storybook/react' +import type { ChangeEvent, FC } from 'react' + type Story = StoryFn const Dl = styled.dl` diff --git a/packages/components/src/chevronDown/mod.tsx b/packages/components/src/chevronDown/mod.tsx index 971ba37..2997e2f 100644 --- a/packages/components/src/chevronDown/mod.tsx +++ b/packages/components/src/chevronDown/mod.tsx @@ -1,8 +1,8 @@ import styled from 'styled-components' -import type { FC } from 'react' - import { SLB30T } from '../colors.js' + +import type { FC } from 'react' import type { Size } from '../types.js' interface ChevronDownProps { diff --git a/packages/components/src/clearIcon/mod.tsx b/packages/components/src/clearIcon/mod.tsx index ab83956..f6f450d 100644 --- a/packages/components/src/clearIcon/mod.tsx +++ b/packages/components/src/clearIcon/mod.tsx @@ -1,9 +1,9 @@ import styled from 'styled-components' import { useCallback } from 'react' -import type { FC, KeyboardEvent } from 'react' - import { SLB30T } from '../colors.js' + +import type { FC, KeyboardEvent } from 'react' import type { Size } from '../types.js' interface ClearIconProps { diff --git a/packages/components/src/core.tsx b/packages/components/src/core.tsx index e2588e7..8e1583e 100644 --- a/packages/components/src/core.tsx +++ b/packages/components/src/core.tsx @@ -7,9 +7,10 @@ import { getMenuDirectionStyles, getToggleDirectionStyles, } from './styles.js' -import type { MenuDirection } from './types.js' import { PB40T, SLB30T } from './colors.js' +import type { MenuDirection } from './types.js' + interface CoreProps { menuDirection?: MenuDirection width?: string diff --git a/packages/components/src/dataList/mod.tsx b/packages/components/src/dataList/mod.tsx index 4b8bc8e..192313a 100644 --- a/packages/components/src/dataList/mod.tsx +++ b/packages/components/src/dataList/mod.tsx @@ -1,10 +1,10 @@ import { useMemo, useState, useRef, useEffect } from 'react' import debounce from 'lodash.debounce' -import type { FC, ChangeEvent } from 'react' - import { Input } from '../input/mod.js' +import type { FC, ChangeEvent } from 'react' + interface DataListProps { value?: string placeholder?: string diff --git a/packages/components/src/dataList/story.tsx b/packages/components/src/dataList/story.tsx index 60b3dae..bfc73a1 100644 --- a/packages/components/src/dataList/story.tsx +++ b/packages/components/src/dataList/story.tsx @@ -1,7 +1,7 @@ -import type { StoryObj } from '@storybook/react' - import { DataList } from './mod.js' +import type { StoryObj } from '@storybook/react' + type Story = StoryObj const Primary: Story = { diff --git a/packages/components/src/icon/mod.tsx b/packages/components/src/icon/mod.tsx new file mode 100644 index 0000000..1576744 --- /dev/null +++ b/packages/components/src/icon/mod.tsx @@ -0,0 +1,18 @@ +import styled from 'styled-components' + +import type { Size } from '../types.js' + +interface IconProps { + color?: string + size?: Size +} + +const Wrap = styled.span` + display: flex; +` +const Icon = () => { + return +} + +export { Icon } +export type { IconProps } diff --git a/packages/components/src/input/mod.tsx b/packages/components/src/input/mod.tsx index 75debbd..c625493 100644 --- a/packages/components/src/input/mod.tsx +++ b/packages/components/src/input/mod.tsx @@ -1,9 +1,10 @@ import { forwardRef, useCallback, useState, useRef } from 'react' import styled from 'styled-components' -import type { KeyboardEvent, ChangeEvent, ForwardedRef, FocusEvent } from 'react' import { ClearIcon } from '../clearIcon/mod.js' import { sizing } from '../styles.js' + +import type { KeyboardEvent, ChangeEvent, ForwardedRef, FocusEvent } from 'react' import type { Size } from '../types.js' interface InputProps { diff --git a/packages/components/src/input/story.tsx b/packages/components/src/input/story.tsx index 2c5bf03..8b95aea 100644 --- a/packages/components/src/input/story.tsx +++ b/packages/components/src/input/story.tsx @@ -1,10 +1,10 @@ -import type { StoryFn } from '@storybook/react' import { useState, useCallback, useRef } from 'react' -import type { ChangeEvent } from 'react' - import { Input } from './mod.js' +import type { StoryFn } from '@storybook/react' +import type { ChangeEvent } from 'react' + const Single: StoryFn = args => { const ref = useRef(null) const [value, setValue] = useState('') diff --git a/packages/components/src/styles.ts b/packages/components/src/styles.ts index f45daac..bd2ce34 100644 --- a/packages/components/src/styles.ts +++ b/packages/components/src/styles.ts @@ -1,7 +1,6 @@ import { css } from 'styled-components' import { PB40T, PB80T, SLB30T } from './colors.js' - import { MenuDirection } from './types.js' const sizing = { diff --git a/packages/ui/package.json b/packages/ui/package.json index 211c799..fa1b65f 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -8,6 +8,7 @@ "prettier": "prettier -w .", "dev": "vite", "lint": "eslint . src --ext .ts,.tsx", + "lint:fix": "npm run lint -- --fix", "build": "tsc && vite build", "preview": "vite preview", "test": "echo \"Error: no test specified\" && exit 1" diff --git a/packages/ui/src/app.tsx b/packages/ui/src/app.tsx index 1783df8..d99bc57 100644 --- a/packages/ui/src/app.tsx +++ b/packages/ui/src/app.tsx @@ -1,11 +1,12 @@ import { BrowserRouter, Routes, Route } from 'react-router-dom' import { createGlobalStyle } from 'styled-components' -import type { FC } from 'react' import { Providers } from './providers.js' import { Layout } from './layout.js' import { Home } from './home.js' +import type { FC } from 'react' + const GlobalStyles = createGlobalStyle` :root { --bg-color: #e0e0e0; diff --git a/packages/ui/src/components/agencies.tsx b/packages/ui/src/components/agencies.tsx index 66ff412..1c36f46 100644 --- a/packages/ui/src/components/agencies.tsx +++ b/packages/ui/src/components/agencies.tsx @@ -1,5 +1,6 @@ import { useCallback, useState } from 'react' import { AutoSuggest } from '@busmap/components' + import type { ChangeEvent, FC } from 'react' interface Props { diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx index 7909754..8483af5 100644 --- a/packages/ui/src/index.tsx +++ b/packages/ui/src/index.tsx @@ -1,4 +1,5 @@ import { createRoot } from 'react-dom/client' + import { BusMap } from './app.js' const root = createRoot(document.querySelector('main') as HTMLElement) diff --git a/packages/ui/src/layout.tsx b/packages/ui/src/layout.tsx index 838cb47..0129309 100644 --- a/packages/ui/src/layout.tsx +++ b/packages/ui/src/layout.tsx @@ -1,9 +1,10 @@ import { useQuery } from 'react-query' import { createPortal } from 'react-dom' -import type { FC, ReactNode } from 'react' import { Agencies } from './components/agencies.js' +import type { FC, ReactNode } from 'react' + export const Layout: FC<{ children: ReactNode }> = ({ children }) => { const { data, error } = useQuery('agencies', async () => { const resp = await fetch('/restbus/agencies') diff --git a/packages/ui/src/providers.tsx b/packages/ui/src/providers.tsx index 9550831..90b0d5c 100644 --- a/packages/ui/src/providers.tsx +++ b/packages/ui/src/providers.tsx @@ -1,4 +1,5 @@ import { QueryClient, QueryClientProvider } from 'react-query' + import type { ReactNode, FC } from 'react' const queryClient = new QueryClient({ diff --git a/packages/web/package.json b/packages/web/package.json index 0b4410e..2c27d3c 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -7,6 +7,7 @@ "scripts": { "prettier": "prettier -w .", "lint": "eslint . src --ext .ts,.tsx --no-error-on-unmatched-pattern", + "lint:fix": "npm run lint -- --fix", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Morgan Ney "