diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a8e74d761..f5f4a8470 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,3 +21,29 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.56.2 + js-sdk-lint: + name: JS SDK Lint + runs-on: ubuntu-latest + timeout-minutes: 10 + defaults: + run: + working-directory: ./sdks/js + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v4 + + - name: Setup pnpm 8 + uses: pnpm/action-setup@v2 + with: + version: 8.6.9 + + - name: Setup Node.js 20.x + uses: actions/setup-node@v2 + with: + node-version: 20.x + + - name: Install Dependencies 🔧 + run: pnpm i + + - name: Check Lint 🔧 + run: npm run lint diff --git a/sdks/js/.eslintrc.js b/sdks/js/.eslintrc.js index 1a7d80dde..9f0d54cf1 100644 --- a/sdks/js/.eslintrc.js +++ b/sdks/js/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { root: true, - extends: ['frontier'], + extends: ['@raystack/eslint-config'], settings: { next: { rootDir: ['apps/*/'] diff --git a/sdks/js/package.json b/sdks/js/package.json index c3b7dbeb0..ba29ebdd1 100644 --- a/sdks/js/package.json +++ b/sdks/js/package.json @@ -24,7 +24,7 @@ "dependencies": { "@changesets/cli": "^2.26.2", "eslint": "^7.32.0", - "eslint-config-frontier": "workspace:^" + "@raystack/eslint-config": "workspace:^" }, "prettier": { "tabWidth": 2, diff --git a/sdks/js/packages/core/package.json b/sdks/js/packages/core/package.json index b6ea7513d..8346ef02b 100644 --- a/sdks/js/packages/core/package.json +++ b/sdks/js/packages/core/package.json @@ -15,7 +15,7 @@ "build": "tsup", "dev": "tsup --watch src", "size": "size-limit", - "lint": "eslint \"./**/*.ts*\"", + "lint": "eslint \"./**/*.ts*\" --ignore-pattern \"*.d.ts\" --ignore-pattern \"*.test.ts\"", "bump-version": "node scripts/bump-version.js", "release:ci": "release-it --ci --no-increment --npm.ignoreVersion", "release:dry": "release-it --dry-run --npm.ignoreVersion", @@ -65,7 +65,7 @@ "esbuild-css-modules-plugin": "^2.7.1", "esbuild-plugin-external-global": "^1.0.1", "eslint": "^7.32.0", - "eslint-config-frontier": "workspace:^", + "@raystack/eslint-config": "workspace:^", "jest": "^29.7.0", "np": "^7.7.0", "prettier": "^2.8.8", diff --git a/sdks/js/packages/core/react/components/organization/domain/verify-domain.tsx b/sdks/js/packages/core/react/components/organization/domain/verify-domain.tsx index 4e2c8333c..6c2651021 100644 --- a/sdks/js/packages/core/react/components/organization/domain/verify-domain.tsx +++ b/sdks/js/packages/core/react/components/organization/domain/verify-domain.tsx @@ -99,8 +99,8 @@ export const VerifyDomain = () => { ) : ( <> - Before we can verify {domain?.name}, you'll need to create a TXT - record in your DNS configuration for this hostname. + Before we can verify {domain?.name}, you'll need to create + a TXT record in your DNS configuration for this hostname. { try { diff --git a/sdks/js/pnpm-lock.yaml b/sdks/js/pnpm-lock.yaml index cc9112322..8aba357c0 100644 --- a/sdks/js/pnpm-lock.yaml +++ b/sdks/js/pnpm-lock.yaml @@ -11,12 +11,12 @@ importers: '@changesets/cli': specifier: ^2.26.2 version: 2.26.2 + '@raystack/eslint-config': + specifier: workspace:^ + version: link:tools/eslint-config eslint: specifier: ^7.32.0 version: 7.32.0 - eslint-config-frontier: - specifier: workspace:^ - version: link:tools/eslint-config devDependencies: '@turbo/gen': specifier: ^1.10.14 @@ -85,6 +85,9 @@ importers: '@radix-ui/react-icons': specifier: ^1.3.0 version: 1.3.0(react@18.2.0) + '@raystack/eslint-config': + specifier: workspace:^ + version: link:../../tools/eslint-config '@raystack/frontier-tsconfig': specifier: workspace:^ version: link:../../tools/tsconfig @@ -118,9 +121,6 @@ importers: eslint: specifier: ^7.32.0 version: 7.32.0 - eslint-config-frontier: - specifier: workspace:^ - version: link:../../tools/eslint-config jest: specifier: ^29.7.0 version: 29.7.0(@types/node@20.6.3) @@ -166,6 +166,12 @@ importers: eslint-plugin-react: specifier: 7.28.0 version: 7.28.0(eslint@7.32.0) + eslint-plugin-react-hooks: + specifier: ^4.6.2 + version: 4.6.2(eslint@7.32.0) + eslint-plugin-test-selectors: + specifier: ^2.1.1 + version: 2.1.1 next: specifier: ^13.4.12 version: 13.4.12(react-dom@18.2.0)(react@18.2.0) @@ -4680,7 +4686,7 @@ packages: eslint-plugin-import: 2.28.1(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.6.0)(eslint@7.32.0) eslint-plugin-jsx-a11y: 6.7.1(eslint@7.32.0) eslint-plugin-react: 7.33.2(eslint@7.32.0) - eslint-plugin-react-hooks: 4.6.0(eslint@7.32.0) + eslint-plugin-react-hooks: 4.6.2(eslint@7.32.0) typescript: 5.2.2 transitivePeerDependencies: - eslint-import-resolver-webpack @@ -4828,8 +4834,8 @@ packages: semver: 6.3.1 dev: false - /eslint-plugin-react-hooks@4.6.0(eslint@7.32.0): - resolution: {integrity: sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==} + /eslint-plugin-react-hooks@4.6.2(eslint@7.32.0): + resolution: {integrity: sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ==} engines: {node: '>=10'} peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 @@ -4885,6 +4891,15 @@ packages: string.prototype.matchall: 4.0.10 dev: false + /eslint-plugin-test-selectors@2.1.1: + resolution: {integrity: sha512-PARAtqSrfvsnQ82enPa3PtxsRGlwvNr4vdWFIZNLZdIqR1s0M/+TWFi2KM1JhtBJgaa8vVLSwUu/sTjSsK1Qqw==} + engines: {node: '>=0.10.0'} + dependencies: + jsx-ast-utils: 3.3.5 + nanoid: 3.3.6 + requireindex: 1.2.0 + dev: false + /eslint-plugin-turbo@1.9.3(eslint@7.32.0): resolution: {integrity: sha512-ZsRtksdzk3v+z5/I/K4E50E4lfZ7oYmLX395gkrUMBz4/spJlYbr+GC8hP9oVNLj9s5Pvnm9rLv/zoj5PVYaVw==} peerDependencies: @@ -8689,6 +8704,11 @@ packages: resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==} dev: false + /requireindex@1.2.0: + resolution: {integrity: sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==} + engines: {node: '>=0.10.5'} + dev: false + /resolve-alpn@1.2.1: resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==} diff --git a/sdks/js/tools/eslint-config/index.js b/sdks/js/tools/eslint-config/index.js index cbcfc8bf1..9243804ec 100644 --- a/sdks/js/tools/eslint-config/index.js +++ b/sdks/js/tools/eslint-config/index.js @@ -1,8 +1,17 @@ /* eslint-disable strict */ module.exports = { - extends: ['next', 'turbo', 'prettier'], + plugins: ["test-selectors"], + extends: [ + 'next', + 'turbo', + 'prettier', + "eslint:recommended", + 'plugin:test-selectors/recommended' + ], rules: { - '@next/next/no-html-link-for-pages': 'off' + '@next/next/no-html-link-for-pages': 'off', + "no-unused-vars": "warn", + "@next/next/no-img-element": "off" }, parserOptions: { babelOptions: { diff --git a/sdks/js/tools/eslint-config/package.json b/sdks/js/tools/eslint-config/package.json index 68b85c0c8..f26c366ff 100644 --- a/sdks/js/tools/eslint-config/package.json +++ b/sdks/js/tools/eslint-config/package.json @@ -1,5 +1,5 @@ { - "name": "eslint-config-frontier", + "name": "@raystack/eslint-config", "version": "0.0.0", "license": "MIT", "main": "index.js", @@ -9,9 +9,11 @@ "eslint-config-prettier": "^8.3.0", "eslint-config-turbo": "^1.9.3", "eslint-plugin-react": "7.28.0", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-test-selectors": "^2.1.1", "next": "^13.4.12" }, "publishConfig": { "access": "public" } -} +} \ No newline at end of file