Skip to content
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

dts lint: add option to ignore dts' builtin eslint config #219

Open
robert-irelan-tiktokusds opened this issue May 17, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@robert-irelan-tiktokusds
Copy link

robert-irelan-tiktokusds commented May 17, 2024

Current Behavior

Currently, dts' builtin eslint config is always merged with a user-provided eslint config in .eslintrc.js. This gives me the following error:

Defaulting to "dts lint src test" 
You can override this in the package.json scripts, like "lint": "dts lint src otherDir"
PluginConflictError: Plugin "prettier" was conflicted between "src/.eslintrc.js » eslint-config-fe-mono/.eslintrc.web.js" and "BaseConfig » plugin:prettier/recommended".
    at mergePlugins (/cloudide/workspace/fe_mono/common/temp/node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:598:19)
    at createConfig (/cloudide/workspace/fe_mono/common/temp/node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:701:9)
    at ConfigArray.extractConfig (/cloudide/workspace/fe_mono/common/temp/node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:877:33)
    at FileEnumerator._isIgnoredFile (/cloudide/workspace/fe_mono/common/temp/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/cli-engine/file-enumerator.js:534:24)
    at FileEnumerator._iterateFilesRecursive (/cloudide/workspace/fe_mono/common/temp/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/cli-engine/file-enumerator.js:470:42)
    at _iterateFilesRecursive.next (<anonymous>)
    at FileEnumerator.iterateFiles (/cloudide/workspace/fe_mono/common/temp/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/cli-engine/file-enumerator.js:299:49)
    at iterateFiles.next (<anonymous>)
    at CLIEngine.executeOnFiles (/cloudide/workspace/fe_mono/common/temp/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/cli-engine/cli-engine.js:797:48)
    at ESLint.lintFiles (/cloudide/workspace/fe_mono/common/temp/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/eslint.js:551:23) {
  messageTemplate: 'plugin-conflict',
  messageData: { pluginId: 'prettier', plugins: [ [Object], [Object] ] }
}

Our project has a custom eslint config that we don't wish to merge with the dts config:

module.exports = {
  root: true,
  extends: ['eslint-config-fe-mono/.eslintrc.node.js'],
};

But there's no way to accomplish this at the moment.

Desired Behavior

Provide a way to tell dts lint to not inject its own eslint config. Similar fixes should also be considered for Babel and Jest.

Suggested Solution

Two options:

  • Add a flag --no-builtin-config to dts lint (and possibly also a similar flag for Jest for dts test and for Babel for dts build and dts watch). For dts lint, this would pass baseConfig: {} to the ESLint constructor here: createBuildConfigs
  • Add an option to dts.config.js to disable builtin configs for the project, without having to pass --no-builtin-config.

Who does this impact? Who is this for?

All users who wish to use their own Eslint config without any config injected by dts.

Describe alternatives you've considered

Nothing is possible at the moment, since there's no way to customize the merge behavior of Object.assign.

Additional context

N/A

@aladdin-add aladdin-add added the bug Something isn't working label May 18, 2024
@aladdin-add aladdin-add self-assigned this May 18, 2024
@aladdin-add
Copy link

I hadn't noticed this, and I agree.

It can be the default (worthy a breaking change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants