Skip to content

Commit

Permalink
fix(config): false positive in "scripts" directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Zamiell committed Nov 3, 2023
1 parent 981ce4e commit b6e3e11
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/eslint-config-isaacscript/configs/base-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const HELPFUL_WARNINGS = {
* The options are [copied from
* Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/import.js).
*
* We also add a "scripts" directory entry for "devDependency".
* We also add a "scripts" directory entry for "devDependencies".
*/
"import/no-extraneous-dependencies": [
"error",
Expand Down Expand Up @@ -52,7 +52,7 @@ const HELPFUL_WARNINGS = {
"**/karma.conf.js", // karma config
"**/.eslintrc.js", // eslint config

"**/scripts/*.{ts,cts,mts}", // TypeScript files inside of a "scripts" directory.
"**/scripts/*.{js,cjs,mjs,ts,cts,mts}", // Files inside of a "scripts" directory.
],
optionalDependencies: false,
},
Expand Down
16 changes: 16 additions & 0 deletions packages/eslint-config-isaacscript/configs/base-n.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ const POSSIBLE_ERRORS = {
"n/no-process-exit": "off",

"n/no-unpublished-bin": "error",

/**
* An exception is made for files in a "scripts" directory, since those should be allowed to
* import from "devDependencies".
*/
"n/no-unpublished-import": "error",

"n/no-unpublished-require": "error",

/** Disabled because this rule is deprecated. */
Expand Down Expand Up @@ -137,6 +143,16 @@ const config = {
...POSSIBLE_ERRORS,
...STYLISTIC_ISSUES,
},

overrides: [
// Imports in a "scripts" directory can use "devDependencies".
{
files: ["**/scripts/*.{js,cjs,mjs,ts,cts,mts}"],
rules: {
"n/no-unpublished-import": "off",
},
},
],
};

module.exports = config;

0 comments on commit b6e3e11

Please sign in to comment.