-
Notifications
You must be signed in to change notification settings - Fork 0
Publish dual ESM and CommonJS outputs #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
d210d10
74ae526
5d2eea6
052ef3c
e3ead78
d7349a1
842b8c8
f4a9e92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,25 @@ import { defineConfig } from 'eslint/config'; | |
| import { configs } from '@croct/eslint-plugin'; | ||
|
|
||
| export default defineConfig( | ||
| configs.typescript, | ||
| configs.typescript.map(config => ({ | ||
| ...config, | ||
| files: config.files ?? ['**/*.ts', '**/*.tsx'], | ||
| ...(config.languageOptions === undefined | ||
| ? {} | ||
| : {languageOptions: { | ||
| ...config.languageOptions, | ||
| parserOptions: { | ||
| ...config.languageOptions.parserOptions, | ||
| projectService: config.languageOptions.parserOptions?.projectService === true | ||
| ? {allowDefaultProject: ['*.config.ts']} | ||
| : config.languageOptions.parserOptions?.projectService, | ||
| }, | ||
| }}), | ||
| })), | ||
| { | ||
| files: ['src/**/*.ts'], | ||
| rules: { | ||
| 'import-x/extensions': 'off', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turning this off for all of The rule was disabled to accommodate
'import-x/extensions': ['error', 'never', {
d: 'always', json: 'always',
pathGroupOverrides: [{pattern: '@croct/time/**', action: 'ignore'}],
}],And add |
||
| 'no-restricted-syntax': [ | ||
| 'error', | ||
| { | ||
|
|
@@ -53,5 +68,16 @@ export default defineConfig( | |
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| { | ||
| files: ['tsup.config.ts'], | ||
| languageOptions: { | ||
| parserOptions: { | ||
| tsconfigRootDir: import.meta.dirname, | ||
| }, | ||
| }, | ||
| rules: { | ||
| 'import-x/no-default-export': 'off', | ||
| }, | ||
| } | ||
| ); | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| export default { | ||
| restoreMocks: true, | ||
| resetMocks: true, | ||
| extensionsToTreatAsEsm: ['.ts'], | ||
| transform: { | ||
| '^.+\\.ts$': [ | ||
| 'ts-jest', | ||
| { | ||
| useESM: true, | ||
| }, | ||
| ], | ||
| }, | ||
| moduleNameMapper: { | ||
| '^(\\.{1,2}/.*)\\.js$': '$1', | ||
| }, | ||
| setupFilesAfterEnv: ['<rootDir>/test/setup-jest.mjs'], | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
.map()silently disables every rule on.mjsfilesIn
@croct/eslint-plugin@0.8.3, the@croct/javascriptblock (which carries all base rules) has nofiles. The?? ['**/*.ts','**/*.tsx']scopes it to TS, so the'*.mjs' 'test/*.mjs'globs added inpackage.json:61are inert.Proof: line 1 of this file uses
import { defineConfig }with spaces, violating@stylistic/object-curly-spacing, and lint still passes.Rewrite using
extends— it already propagatesfilesto the extended configs — instead of rewriting the preset's structure:ecmaVersion: 2022is required because the preset sets2018andtest/package-contract.mjsuses top-levelawait.