Skip to content

Commit

Permalink
feat(eslint, prettier): Update eslint and prettier configurations (#69)
Browse files Browse the repository at this point in the history
### Prettier

- Convert configuration to JSON
- Turn off semicolons
- Use tabs instead of spaces for indentation

### Eslint

- Use standard-with-typescript instead of xo
- Remove custom rule definitions
- Remove dependency on eslint-plugin-prettier
  • Loading branch information
jsec authored Nov 22, 2023
1 parent d5a0639 commit 39fa095
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 458 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-planes-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@jarsec/prettier-config': patch
---

Remove space indentation setting
7 changes: 7 additions & 0 deletions .changeset/quick-turkeys-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@jarsec/prettier-config": major
---

- Convert configuration file to JSON
- No semicolons allowed
- Use tabs instead of spaces for indentation
8 changes: 8 additions & 0 deletions .changeset/thin-grapes-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@jarsec/eslint-config': major
---

- Remove xo and xo-typescript configurations
- Add standard-with-typescript configuration
- Remove eslint-plugin-prettier, let Prettier handle formatting in a separate step
- Remove custom TypeScript rules
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
"devDependencies": {
"@changesets/cli": "2.26.2",
"@jarsec/eslint-config": "workspace:*",
"@jarsec/prettier-config": "workspace:*",
"@jarsec/tsconfig": "workspace:*",
"eslint": "8.53.0",
"prettier": "3.1.0",
"turbo": "latest"
},
"packageManager": "pnpm@8.10.5"
"packageManager": "pnpm@8.10.5",
"prettier": "@jarsec/prettier-config"
}
89 changes: 34 additions & 55 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,36 @@
/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable @typescript-eslint/no-require-imports */
/* eslint-disable @typescript-eslint/no-unsafe-call */

require("@rushstack/eslint-patch/modern-module-resolution");

const rules = {
"comma-dangle": "off",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"no-mixed-spaces-and-tabs": "off",
"no-warning-comments": "off",
"object-curly-spacing": "off",
"operator-linebreak": "off",
};
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
env: {
node: true,
},
extends: [
"xo",
"xo-typescript",
"plugin:perfectionist/recommended-natural",
"plugin:prettier/recommended",
],
overrides: [
{
files: ["**/*/*.{test,spec}.ts"],
rules: {
...rules,
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/unbound-method": "off",
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
},
plugins: [
"@typescript-eslint/eslint-plugin",
"import",
"perfectionist",
"prettier",
],
rules,
settings: {
"import/resolver": {
node: true,
typescript: true,
},
},
};
env: {
node: true
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:perfectionist/recommended-natural',
'prettier'
],
overrides: [
{
files: ['**/*/*.{test,spec}.ts'],
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/unbound-method': 'off'
}
}
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json'
},
plugins: ['import', 'perfectionist', '@typescript-eslint/eslint-plugin'],
settings: {
'import/resolver': {
node: true,
typescript: true
}
}
}
32 changes: 17 additions & 15 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@
"access": "public"
},
"dependencies": {
"@rushstack/eslint-patch": "1.5.1",
"@typescript-eslint/eslint-plugin": "6.11.0",
"@typescript-eslint/parser": "6.11.0",
"eslint-config-prettier": "9.0.0",
"eslint-config-xo": "0.43.1",
"eslint-config-xo-typescript": "1.0.1",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-perfectionist": "2.4.0",
"eslint-plugin-prettier": "5.0.1"
"@rushstack/eslint-patch": "^1.6.0",
"@types/node": "^20.9.3",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard-with-typescript": "^40.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.3.1",
"eslint-plugin-perfectionist": "^2.4.0",
"eslint-plugin-promise": "^6.1.1",
"typescript": "^5.2.2"
},
"devDependencies": {
"@types/node": "20.9.1",
"eslint": "8.53.0",
"typescript": "5.2.2"
"@types/node": "^20.9.1",
"eslint": "^8.53.0",
"typescript": "^5.2.2"
},
"peerDependencies": {
"eslint": "8.53.0",
"typescript": "5.2.2"
"eslint": "^8.53.0",
"typescript": "^5.2.2"
}
}
11 changes: 0 additions & 11 deletions packages/prettier/index.js

This file was deleted.

11 changes: 11 additions & 0 deletions packages/prettier/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"semi": false,
"arrowParens": "avoid",
"trailingComma": "none",
"bracketSpacing": true,
"endOfLine": "auto",
"printWidth": 100,
"tabWidth": 2,
"useTabs": true
}
2 changes: 1 addition & 1 deletion packages/prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"author": "Jarrod Seccombe <jarrod.seccombe@icloud.com",
"files": [
"index.js",
"index.json",
".prettierignore"
],
"main": "index.js",
Expand Down
Loading

0 comments on commit 39fa095

Please sign in to comment.