Skip to content

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

@robert-irelan-tiktokusds

Description

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions