Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(linter): check for all .eslintrc.* files when generating a package (
- Loading branch information
Mr Mo
committed
Oct 12, 2022
1 parent
82d43af
commit d4fd7c0
Showing
4 changed files
with
195 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
import type { Tree } from '@nrwl/devkit'; | ||
|
||
const eslintFileList = ['.eslintrc.json', '.eslintrc.js']; | ||
export const eslintConfigFileWhitelist = [ | ||
'.eslintrc', | ||
'.eslintrc.js', | ||
'.eslintrc.cjs', | ||
'.eslintrc.yaml', | ||
'.eslintrc.yml', | ||
'.eslintrc.json', | ||
]; | ||
|
||
export function findEslintFile(tree: Tree): string | null { | ||
for (const file of eslintFileList) { | ||
for (const file of eslintConfigFileWhitelist) { | ||
if (tree.exists(file)) { | ||
return file; | ||
} | ||
} | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters