diff --git a/eslint.config.js b/eslint.config.js index 28c768e..7ad2471 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -6,7 +6,7 @@ * * Explore our open-source projects: {@link https://github.com/kurocado-studio} */ -import { eslintNodeConfig } from './src/eslint/eslint.node.js'; +import { eslintNodeConfig } from './src/index.js'; export default [ ...eslintNodeConfig, @@ -16,17 +16,4 @@ export default [ 'sort-keys': 'error', }, }, - { - ignores: [ - 'src/vitest/setup.web.ts', - 'src/vitest/setup.node.ts', - 'src/vitest/vitest.web.ts', - 'src/vitest/vitest.node.ts', - 'dist/*', - '**/*.d.ts', - 'node_modules', - '**/temp.js', - 'config/*', - ], - }, ]; diff --git a/package.json b/package.json index cde13e8..7d68cf4 100644 --- a/package.json +++ b/package.json @@ -8,28 +8,32 @@ }, "repository": { "type": "git", - "url": "https://github.com/kurocado-studio/styleguide.git" + "url": "git+https://github.com/kurocado-studio/styleguide.git" }, "license": "MIT", "type": "module", "scripts": { "commitlint": "pnpm exec commitlint --edit", "eslint-check": "eslint --max-warnings=0 .", + "eslint": "eslint --max-warnings=0 .", "prepare": "husky install", "prettier-check": "prettier --check . ", "prettier-fix": "prettier --check . --write", "semantic-release": "semantic-release", - "test": "echo \"no test specified\" && exit 0", - "build": "tsc" + "build": "tsc && copyfiles -u 1 src/tsconfig/*.json dist" }, "main": "dist/index.js", + "module": "dist/index.js", + "files": [ + "dist" + ], "exports": { ".": "./dist/index.js", - "./tsconfig/base": "./src/tsconfig/tsconfig.json", - "./tsconfig/node": "./src/tsconfig/tsconfig.node.json", - "./tsconfig/nestjs": "./src/tsconfig/tsconfig.nestjs.json", - "./tsconfig/react": "./src/tsconfig/tsconfig.react.json", - "./tsconfig/remix": "./src/tsconfig/tsconfig.remix.json" + "./tsconfig/base": "./dist/tsconfig/tsconfig.json", + "./tsconfig/node": "./dist/tsconfig/tsconfig.node.json", + "./tsconfig/nestjs": "./dist/tsconfig/tsconfig.nestjs.json", + "./tsconfig/react": "./dist/tsconfig/tsconfig.react.json", + "./tsconfig/remix": "./dist/tsconfig/tsconfig.remix.json" }, "lint-staged": { "*": [ @@ -111,10 +115,10 @@ "vitest": "^2.1.3", "vitest-axe": "^0.1.0" }, - "files": [ - "dist" - ], "publishConfig": { "access": "public" + }, + "devDependencies": { + "copyfiles": "^2.4.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 843664a..3216c3b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -191,6 +191,10 @@ importers: vitest-axe: specifier: ^0.1.0 version: 0.1.0(vitest@2.1.6(@types/node@20.5.0)(jsdom@25.0.1)) + devDependencies: + copyfiles: + specifier: ^2.4.1 + version: 2.4.1 packages: @@ -2234,6 +2238,10 @@ packages: resolution: {integrity: sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==} engines: {node: '>= 0.6'} + copyfiles@2.4.1: + resolution: {integrity: sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==} + hasBin: true + core-js-compat@3.39.0: resolution: {integrity: sha512-VgEUx3VwlExr5no0tXlBt+silBvhTryPwCXRI2Id1PN8WTKu7MreethvddqOubrYxkFdv/RnYrqlv1sFNAUelw==} @@ -2989,6 +2997,9 @@ packages: resolution: {integrity: sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -3081,6 +3092,10 @@ packages: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true + glob@7.2.3: + resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Glob versions prior to v9 are no longer supported + global-directory@4.0.1: resolution: {integrity: sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==} engines: {node: '>=18'} @@ -3279,6 +3294,10 @@ packages: resolution: {integrity: sha512-MWDKS3AS1bGCHLBA2VLImJz42f7bJh8wQsTGCzI3j519/CASStoDONUBVz2I/VID0MpiX3SGSnbOD2xUalbE5g==} engines: {node: '>=18'} + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} @@ -3505,6 +3524,9 @@ packages: resolution: {integrity: sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ==} engines: {node: '>= 0.4'} + isarray@0.0.1: + resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==} + isarray@1.0.0: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} @@ -4127,6 +4149,9 @@ packages: node-releases@2.0.18: resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} + noms@0.0.0: + resolution: {integrity: sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow==} + normalize-package-data@2.5.0: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} @@ -4457,6 +4482,10 @@ packages: resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} @@ -4811,6 +4840,9 @@ packages: resolution: {integrity: sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==} engines: {node: '>=18'} + readable-stream@1.0.34: + resolution: {integrity: sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==} + readable-stream@2.3.8: resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} @@ -5187,6 +5219,9 @@ packages: resolution: {integrity: sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==} engines: {node: '>= 0.4'} + string_decoder@0.10.31: + resolution: {integrity: sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==} + string_decoder@1.1.1: resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} @@ -5550,6 +5585,10 @@ packages: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} engines: {node: '>= 0.8'} + untildify@4.0.0: + resolution: {integrity: sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==} + engines: {node: '>=8'} + update-browserslist-db@1.1.1: resolution: {integrity: sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==} hasBin: true @@ -8287,6 +8326,16 @@ snapshots: cookie@0.7.1: {} + copyfiles@2.4.1: + dependencies: + glob: 7.2.3 + minimatch: 3.1.2 + mkdirp: 1.0.4 + noms: 0.0.0 + through2: 2.0.5 + untildify: 4.0.0 + yargs: 16.2.0 + core-js-compat@3.39.0: dependencies: browserslist: 4.24.2 @@ -9228,6 +9277,8 @@ snapshots: dependencies: minipass: 7.1.2 + fs.realpath@1.0.0: {} + fsevents@2.3.3: optional: true @@ -9321,6 +9372,15 @@ snapshots: package-json-from-dist: 1.0.1 path-scurry: 1.11.1 + glob@7.2.3: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + global-directory@4.0.1: dependencies: ini: 4.1.1 @@ -9522,6 +9582,11 @@ snapshots: index-to-position@0.1.2: {} + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + inherits@2.0.4: {} ini@1.3.8: {} @@ -9707,6 +9772,8 @@ snapshots: call-bind: 1.0.7 get-intrinsic: 1.2.4 + isarray@0.0.1: {} + isarray@1.0.0: {} isarray@2.0.5: {} @@ -10506,6 +10573,11 @@ snapshots: node-releases@2.0.18: {} + noms@0.0.0: + dependencies: + inherits: 2.0.4 + readable-stream: 1.0.34 + normalize-package-data@2.5.0: dependencies: hosted-git-info: 2.8.9 @@ -10775,6 +10847,8 @@ snapshots: path-exists@5.0.0: {} + path-is-absolute@1.0.1: {} + path-key@3.1.1: {} path-key@4.0.0: {} @@ -11068,6 +11142,13 @@ snapshots: type-fest: 4.29.0 unicorn-magic: 0.1.0 + readable-stream@1.0.34: + dependencies: + core-util-is: 1.0.3 + inherits: 2.0.4 + isarray: 0.0.1 + string_decoder: 0.10.31 + readable-stream@2.3.8: dependencies: core-util-is: 1.0.3 @@ -11566,6 +11647,8 @@ snapshots: define-properties: 1.2.1 es-object-atoms: 1.0.0 + string_decoder@0.10.31: {} + string_decoder@1.1.1: dependencies: safe-buffer: 5.1.2 @@ -11916,6 +11999,8 @@ snapshots: unpipe@1.0.0: {} + untildify@4.0.0: {} + update-browserslist-db@1.1.1(browserslist@4.24.2): dependencies: browserslist: 4.24.2 diff --git a/src/eslint/constants.js b/src/eslint/constants.js index e4ff4b2..5bde610 100644 --- a/src/eslint/constants.js +++ b/src/eslint/constants.js @@ -6,6 +6,17 @@ * * Explore our open-source projects: {@link https://github.com/kurocado-studio} */ +import babelParser from '@babel/eslint-parser'; +import tsRecommended from '@typescript-eslint/eslint-plugin'; +import typescriptParser from '@typescript-eslint/parser'; +import prettierConfig from 'eslint-config-prettier'; +import eslintPluginImport from 'eslint-plugin-import'; +import tsdocRecommended from 'eslint-plugin-tsdoc'; +import unicornRecommended from 'eslint-plugin-unicorn'; +import vitestRecommended from 'eslint-plugin-vitest'; + +import { base } from './rules/base/index.js'; + const SPEC_PREFIX = 'spec'; const TEST_PREFIX = 'test'; @@ -21,3 +32,73 @@ export const sharedEslintConfig = { TYPESCRIPT_FILES: ['*.ts?(x)'], TYPESCRIPT_TEST_FILES: [`*.${TEST_PREFIX}.ts?(x)`, `*.${SPEC_PREFIX}.ts?(x)`], }; + +export const typescriptLanguageOptions = { + files: sharedEslintConfig.TYPESCRIPT_FILES, + languageOptions: { + globals: { + [`es${sharedEslintConfig.ECMA_VERSION}`]: true, + }, + parser: typescriptParser, + parserOptions: { + ecmaVersion: sharedEslintConfig.ECMA_VERSION, + project: true, + requireConfigFile: true, + sourceType: 'module', + tsconfigRootDir: process.cwd(), + }, + }, +}; + +export const javascriptLanguageOptions = { + files: sharedEslintConfig.JAVASCRIPT_FILES, + languageOptions: { + globals: { + [`es${sharedEslintConfig.ECMA_VERSION}`]: true, + }, + parser: babelParser, + parserOptions: { + ecmaVersion: sharedEslintConfig.ECMA_VERSION, + project: true, + requireConfigFile: false, + sourceType: 'module', + }, + }, +}; + +export const tsconfigRootDir = process.cwd(); + +export const typescriptLanguageRootConfig = { + ...typescriptLanguageOptions, + plugins: { + '@typescript-eslint': tsRecommended, + import: eslintPluginImport, + prettierConfig, + tsdoc: tsdocRecommended, + unicorn: unicornRecommended, + vitest: vitestRecommended, + }, + rules: { + ...base.rules, + ...eslintPluginImport.configs.recommended.rules, + ...eslintPluginImport.configs.typescript.rules, + }, + settings: { + 'import/resolver': { node: {} }, + }, +}; + +export const javascriptLanguageRootConfig = { + ...javascriptLanguageOptions, + plugins: { + '@typescript-eslint': tsRecommended, + import: eslintPluginImport, + prettierConfig, + tsdoc: tsdocRecommended, + unicorn: unicornRecommended, + vitest: vitestRecommended, + }, + rules: { + '@typescript-eslint/no-var-requires': 'off', + }, +}; diff --git a/src/eslint/eslint.base.js b/src/eslint/eslint.base.js index 5debaef..37dcc18 100644 --- a/src/eslint/eslint.base.js +++ b/src/eslint/eslint.base.js @@ -6,105 +6,36 @@ * * Explore our open-source projects: {@link https://github.com/kurocado-studio} */ - -/** - * @see https://github.com/eslint/eslint/issues/3458 - */ -// Core ESLint Configs -import babelParser from '@babel/eslint-parser'; -import eslintRecommended from '@eslint/js'; -// TypeScript Configs -import tsRecommended from '@typescript-eslint/eslint-plugin'; -import typescriptParser from '@typescript-eslint/parser'; -import prettierConfig from 'eslint-config-prettier'; import eslintPluginImport from 'eslint-plugin-import'; -import reactRecommended from 'eslint-plugin-react'; -import reactHooksRecommended from 'eslint-plugin-react-hooks'; -import tsdocRecommended from 'eslint-plugin-tsdoc'; -import unicornRecommended from 'eslint-plugin-unicorn'; import vitestRecommended from 'eslint-plugin-vitest'; -import { dirname } from 'node:path'; -import { fileURLToPath } from 'node:url'; -import { sharedEslintConfig } from './constants.js'; -import { base } from './rules/base/index.js'; +import { + javascriptLanguageRootConfig, + sharedEslintConfig, + typescriptLanguageRootConfig, +} from './constants.js'; import { unicornConfig } from './rules/base/unicorn.js'; -import { vitestConfig } from './rules/vitest/index.js'; -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); - -const { - ECMA_VERSION, - JAVASCRIPT_FILES, - JAVASCRIPT_TEST_FILES, - TYPESCRIPT_FILES, - TYPESCRIPT_TEST_FILES, -} = sharedEslintConfig; +const { JAVASCRIPT_TEST_FILES, TYPESCRIPT_TEST_FILES } = sharedEslintConfig; export const eslintBaseConfig = [ - base, ...unicornConfig.overrides, + javascriptLanguageRootConfig, { - ignores: ['!.*.js'], - languageOptions: { - globals: { - [`es${ECMA_VERSION}`]: true, - }, - parserOptions: { - ecmaVersion: ECMA_VERSION, - project: true, - sourceType: 'module', - tsconfigRootDir: __dirname, - }, - }, - plugins: { - '@typescript-eslint': tsRecommended, - eslintRecommended, - import: eslintPluginImport, - prettierConfig, - react: reactRecommended, - 'react-hooks': reactHooksRecommended, - tsdoc: tsdocRecommended, - unicorn: unicornRecommended, - vitest: vitestRecommended, - }, - rules: {}, - settings: { - 'import/resolver': { node: {} }, - }, - }, - { - files: JAVASCRIPT_FILES, - languageOptions: { - parser: babelParser, - parserOptions: { - project: true, - requireConfigFile: false, - }, - }, - }, - { - files: TYPESCRIPT_FILES, - languageOptions: { - parser: typescriptParser, - parserOptions: { - ecmaVersion: ECMA_VERSION, - project: '../../tsconfig.json', - sourceType: 'module', - tsconfigRootDir: __dirname, - }, + ...typescriptLanguageRootConfig, + rules: { + ...typescriptLanguageRootConfig.rules, + ...eslintPluginImport.configs.recommended.rules, + ...eslintPluginImport.configs.typescript.rules, }, }, { env: { node: true }, extends: ['plugin:vitest/recommended'], files: [...TYPESCRIPT_TEST_FILES, ...JAVASCRIPT_TEST_FILES], - plugins: ['vitest'], - rules: { - ...vitestConfig.rules, - '@typescript-eslint/no-unsafe-call': 'off', - 'import/order': 'off', + plugins: { + import: eslintPluginImport, + vitest: vitestRecommended, }, }, { @@ -124,4 +55,7 @@ export const eslintBaseConfig = [ 'import/no-default-export': 'off', }, }, + { + ignores: ['dist/*', '**/*.d.ts', 'node_modules', '**/temp.js', 'config/*'], + }, ]; diff --git a/src/eslint/eslint.browser.js b/src/eslint/eslint.browser.js index c311c30..3375ff9 100644 --- a/src/eslint/eslint.browser.js +++ b/src/eslint/eslint.browser.js @@ -6,13 +6,29 @@ * * Explore our open-source projects: {@link https://github.com/kurocado-studio} */ +import babelParser from '@babel/eslint-parser'; + +import { + javascriptLanguageOptions, + typescriptLanguageRootConfig, +} from './constants.js'; import { eslintBaseConfig } from './eslint.base.js'; -export const eslintBrowserConfig = { +export const eslintBrowserConfig = [ ...eslintBaseConfig, - languageOptions: { - globals: { - browser: true, + { + ...typescriptLanguageRootConfig, + rules: { + ...typescriptLanguageRootConfig.rules, + 'import/no-cycle': 'off', + }, + settings: { + 'import/resolver': { + alias: { + extensions: ['.ts', '.tsx', '.js', '.jsx'], + map: [['~', './app']], + }, + }, }, }, -}; +]; diff --git a/src/eslint/eslint.react.js b/src/eslint/eslint.react.js index aae53af..4d24d0c 100644 --- a/src/eslint/eslint.react.js +++ b/src/eslint/eslint.react.js @@ -12,15 +12,18 @@ import reactHooksRecommended from 'eslint-plugin-react-hooks'; import { reactEslintConfig } from './rules/react/index.js'; -export const eslintReactConfig = { - ...reactEslintConfig, - ...jsxA11yRecommended, - ...reactHooksRecommended, - ...reactRecommended, - plugins: ['react'], - settings: { - react: { - version: 'detect', +export const eslintReactConfig = [ + { + plugins: { + 'jsx-a11y': jsxA11yRecommended, + react: reactRecommended, + 'react-hooks': reactHooksRecommended, + }, + rules: reactEslintConfig.rules, + settings: { + react: { + version: 'detect', + }, }, }, -}; +]; diff --git a/src/eslint/rules/base/unicorn.js b/src/eslint/rules/base/unicorn.js index a4b99e1..0fb8685 100644 --- a/src/eslint/rules/base/unicorn.js +++ b/src/eslint/rules/base/unicorn.js @@ -1,3 +1,5 @@ +import unicorn from 'eslint-plugin-unicorn'; + /** * Made with ❤️ and adobo by Kurocado Studio * Copyright (c) 2024. All Rights Reserved. @@ -10,6 +12,7 @@ export const unicornConfig = { overrides: [ { files: ['**/*.tsx'], // Target only .tsx files + plugins: { unicorn }, rules: { /** * Require pascalCase filename case for all linted files. @@ -27,6 +30,7 @@ export const unicornConfig = { }, { files: ['**/*.ts', '**/*.js'], // Target other files for camelCase + plugins: { unicorn }, rules: { /** * Require camelCase filename case for all linted files. diff --git a/src/index.ts b/src/index.js similarity index 90% rename from src/index.ts rename to src/index.js index 82b9855..57ec7a0 100644 --- a/src/index.ts +++ b/src/index.js @@ -13,6 +13,3 @@ export { semanticReleaseNpmConfig } from './semantic-release/semanticRelease.npm export { viteNodeConfig } from './vite/vite.node.js'; export { viteNpmConfig } from './vite/vite.npm.js'; export { viteWebConfig } from './vite/vite.web.js'; - -export * from './vite/setup.node.js'; -export * from './vite/setup.web.js'; diff --git a/src/tsconfig/tsconfig.nestjs.json b/src/tsconfig/tsconfig.nestjs.json index 71c57a6..e4788b4 100644 --- a/src/tsconfig/tsconfig.nestjs.json +++ b/src/tsconfig/tsconfig.nestjs.json @@ -7,8 +7,6 @@ "experimentalDecorators": true, "lib": ["ES2020"], "module": "CommonJS", - "outDir": "./dist", - "rootDir": "./src", "target": "ES2020" }, "include": ["src"], diff --git a/src/tsconfig/tsconfig.node.json b/src/tsconfig/tsconfig.node.json index 86e4c11..0e595bb 100644 --- a/src/tsconfig/tsconfig.node.json +++ b/src/tsconfig/tsconfig.node.json @@ -4,8 +4,6 @@ "display": "Kurocado Studio Node tsconfig", "compilerOptions": { "allowSyntheticDefaultImports": true, - "declaration": true, - "declarationDir": "./dist", "emitDecoratorMetadata": true, "esModuleInterop": true, "experimentalDecorators": true, diff --git a/src/vite/setup.web.js b/src/vite/setup.web.js index c70434e..3defb73 100644 --- a/src/vite/setup.web.js +++ b/src/vite/setup.web.js @@ -6,13 +6,11 @@ * * Explore our open-source projects: {@link https://github.com/kurocado-studio} */ - -/* eslint @typescript-eslint/no-unsafe-member-access: 0 */ import '@testing-library/jest-dom/vitest'; import { config } from 'dotenv'; import { expect, vi } from 'vitest'; -import 'vitest-axe/extend-expect'; -import * as matchers from 'vitest-axe/matchers'; +import 'vitest-axe/extend-expect.js'; +import * as matchers from 'vitest-axe/matchers.js'; config({ path: '.env.test' }); diff --git a/src/vite/vite.node.js b/src/vite/vite.node.js index 4f0c2b5..73fbc38 100644 --- a/src/vite/vite.node.js +++ b/src/vite/vite.node.js @@ -6,7 +6,7 @@ * * Explore our open-source projects: {@link https://github.com/kurocado-studio} */ -import { viteConfig } from './config'; +import { viteConfig } from './config.js'; export const viteNodeConfig = { plugins: viteConfig.plugins, diff --git a/src/vite/vite.npm.js b/src/vite/vite.npm.js index 8b48161..e8e052d 100644 --- a/src/vite/vite.npm.js +++ b/src/vite/vite.npm.js @@ -10,7 +10,7 @@ import fs from 'node:fs'; import path from 'node:path'; import dts from 'vite-plugin-dts'; -import { viteConfig } from './config'; +import { viteConfig } from './config.js'; const packageJsonPath = path.resolve(process.cwd(), 'package.json'); const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); @@ -28,7 +28,7 @@ const getFileName = (name, format) => { export const viteNpmConfig = { build: { lib: { - entry: path.resolve(__dirname, 'src/index.ts'), + entry: path.resolve(process.cwd(), 'src/index.js'), fileName: (format) => getFileName(packageName, format), formats: ['es', 'cjs'], name: getGlobalName(packageName), diff --git a/src/vite/vite.web.js b/src/vite/vite.web.js index 95566fb..86b66c3 100644 --- a/src/vite/vite.web.js +++ b/src/vite/vite.web.js @@ -8,7 +8,7 @@ */ import { vitePlugin as remixVitePlugin } from '@remix-run/dev'; -import { viteConfig } from './config'; +import { viteConfig } from './config.js'; export const viteWebConfig = { build: { @@ -31,3 +31,4 @@ export const viteWebConfig = { setupFiles: './setup.web.js', }, }; +//# sourceMappingURL=vite.web.js.map diff --git a/tsconfig.json b/tsconfig.json index bb6569d..37c0615 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,11 @@ { "extends": ["./src/tsconfig/tsconfig.node.json"], "compilerOptions": { + "declaration": true, + "declarationDir": "./dist", + "esModuleInterop": true, "outDir": "./dist", + "resolveJsonModule": true, "rootDir": "./src", "typeRoots": ["./src/types", "eslint-plugin-tsdoc"] },