Skip to content

Commit

Permalink
fix: share node config
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienMartel committed Jul 31, 2023
1 parent c0c26ed commit 97115ec
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 39 deletions.
28 changes: 1 addition & 27 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'import'],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts']
},
'import/resolver': {
typescript: {
alwaysTryTypes: true
}
}
},
extends: [
'airbnb-base',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier'
],
extends: ['./node'],
rules: {
indent: 'off',
'no-use-before-define': 'off',
'no-else-return': [
'error',
{
allowElseIf: true
}
],
'import/extensions': 'off',
'no-console': 'off'
}
}
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ npx @monogram/eslint-config
Install dependencies

```sh
npm i -D eslint @monogram/eslint-config
pnpm add -D eslint @monogram/eslint-config
```

Add the following to a `.eslintrc.js` file, while replacing `ENVIRONMENT` with the name of a supported environment
Expand All @@ -33,7 +33,3 @@ module.exports = {
- [Node.js]("./node.js")
- [Next.js]("./next.js")
- Svelte _(coming soon)_

## TODO

- integrate [release-please](https://github.com/googleapis/release-please) since `standard-version` is deprecated
4 changes: 3 additions & 1 deletion node.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ module.exports = {
],
rules: {
indent: 'off',
'@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }],
'no-use-before-define': 'off',
'no-else-return': [
'error',
{
allowElseIf: true
}
],
'import/extensions': 'off'
'import/extensions': 'off',
'import/prefer-default-export': 'off'
}
}
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { existsSync, writeFileSync } from 'node:fs'
import { execSync } from 'node:child_process'
import { select, confirm } from '@inquirer/prompts'
import {
AvailableConfig,
type PackageManager,
type AvailableConfig,
AVAILABLE_CONFIGS,
ESLINT_FILENAME,
PACKAGE_NAME,
PackageManager,
AVAILABLE_CONFIGS,
INSTALL_PREFIXES
} from './constants'
import choosePackageManager from './package-manager'
import { choosePackageManager } from './package-manager'

if (existsSync(`${process.cwd()}/${ESLINT_FILENAME}`)) {
confirm({ message: `Do you want to replace the current ${ESLINT_FILENAME} file?` }).then(
Expand Down
4 changes: 2 additions & 2 deletions src/package-manager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { existsSync } from 'node:fs'
import { select, confirm } from '@inquirer/prompts'
import { PackageManager, LOCK_FILES, PACKAGE_MANAGERS } from './constants'
import { type PackageManager, LOCK_FILES, PACKAGE_MANAGERS } from './constants'

export default async function choosePackageManager(): Promise<PackageManager> {
export async function choosePackageManager(): Promise<PackageManager> {
const packageManager = findPackageManager()

if (packageManager === undefined) {
Expand Down

0 comments on commit 97115ec

Please sign in to comment.