Skip to content

Commit

Permalink
add eslint-plugin-n support
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-stillman committed Sep 28, 2024
1 parent b67eabc commit 67b36a8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Lintier's goal is to provide a minimal foundation, allowing you to further custo

## Update for ESLint 9

As of Fall 2024, the community is still updating various packages to be compatible with ESLint 9. This version of lintier disables currently incompatible packages like [eslint-plugin-react-hooks](https://github.com/facebook/react/issues/28313), [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node), and the [airbnb styleguide](https://github.com/airbnb/javascript/issues/2961).
As of Fall 2024, the community is still updating various packages to be compatible with ESLint 9. This version of lintier disables currently incompatible packages like [eslint-plugin-react-hooks](https://github.com/facebook/react/issues/28313) and the [airbnb styleguide](https://github.com/airbnb/javascript/issues/2961).

## Usage

Expand Down
4 changes: 2 additions & 2 deletions src/installDependencies/installDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const installDeps = async ({

export const getDepList = ({
react,
// eslint-disable-next-line @typescript-eslint/no-unused-vars

node,
styleLint,
sass,
Expand All @@ -73,7 +73,7 @@ export const getDepList = ({
'eslint-plugin-prettier',
'globals',
'typescript-eslint',
// ...(node ? ['eslint-plugin-node'] : []),
...(node ? ['eslint-plugin-n'] : []),
...(react
? ['eslint-plugin-react' /* , 'eslint-plugin-react-hooks' */]
: []),
Expand Down
1 change: 1 addition & 0 deletions src/installDependencies/pinnedVersions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const PINNED_VERSIONS = {
eslint: '9.11.1',
'eslint-config-prettier': '9.1.0',
'eslint-plugin-prettier': '5.2.1',
'eslint-plugin-n': '17.10.3',
'eslint-plugin-react': '7.36.1',
globals: '15.9.0',
'lint-staged': '15.2.10',
Expand Down
19 changes: 16 additions & 3 deletions src/writeConfigs/getEslintConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export default tseslint.config(
? `
react.configs.flat.recommended,`
: ''
}${
node
? `
nodePlugin.configs['flat/recommended'],`
: ''
}
eslintPluginPrettierRecommended,
{
Expand All @@ -44,7 +49,6 @@ export default tseslint.config(
`;

const getImports = ({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
node,
react,
}: {
Expand All @@ -55,8 +59,17 @@ const getImports = ({
import eslint from '@eslint/js';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
${react ? "import react from 'eslint-plugin-react';" : ''}
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';${
react
? `
import react from 'eslint-plugin-react';`
: ''
}${
node
? `
import nodePlugin from 'eslint-plugin-n';`
: ''
}
import globals from 'globals';`;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down

0 comments on commit 67b36a8

Please sign in to comment.