Skip to content

Commit 3987872

Browse files
committed
fix: suppress n/no-unpublished-import for eslint.config.* files
eslint.config.* files always import devDependencies (ESLint plugins/presets) by design — they are never part of the published package. However, projects without a "files" field in package.json cause npm to default to publishing everything, making eslint.config.* appear to be a published file. In that case the rule fires on line 1 of every project's eslint.config.mjs: "@sofie-automation/code-standard-preset" is not published n/no-unpublished-import We already suppress n/no-extraneous-import for the same files. Add the same exemption for n/no-unpublished-import.
1 parent 6f7273c commit 3987872

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

eslint/main.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,13 @@ export async function generateEslintConfig(options) {
221221
? {
222222
files: ['eslint.config.*'],
223223
rules: {
224+
// eslint.config.* files always import devDependencies (ESLint plugins/presets)
225+
// by design — they are never part of the published package. The n/ rules flag
226+
// these imports if the project has no "files" field in package.json (because
227+
// npm then defaults to publishing everything, making eslint.config.* look like
228+
// a published file). Suppress both rules unconditionally for config files.
224229
'n/no-extraneous-import': 'off',
230+
'n/no-unpublished-import': 'off',
225231
},
226232
}
227233
: null,

0 commit comments

Comments
 (0)