Skip to content

Commit

Permalink
feat(prettier)!: use tabs instead of spaces (#42)
Browse files Browse the repository at this point in the history
Resolves #34
  • Loading branch information
mheob committed Sep 16, 2022
1 parent 7aad5cc commit cf8ba94
Show file tree
Hide file tree
Showing 25 changed files with 401 additions and 394 deletions.
6 changes: 6 additions & 0 deletions .changeset/lemon-cheetahs-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@mheob/eslint-config': patch
'@mheob/prettier-config': patch
---

Format all files to the new tabs instead of spaces behaviour
5 changes: 5 additions & 0 deletions .changeset/light-llamas-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mheob/prettier-config': major
---

Switch from spaces to tabs as indentation
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_style = tab
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
Expand Down
4 changes: 2 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @type {import('eslint').ESLint.ConfigData} */
module.exports = {
root: true,
extends: ['@mheob/eslint-config'],
root: true,
extends: ['@mheob/eslint-config'],
};
46 changes: 23 additions & 23 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"],
"labels": ["dependencies"],
"rangeStrategy": "replace",
"separateMajorMinor": true,
"dependencyDashboard": true,
"dependencyDashboardAutoclose": false,
"major": {
"dependencyDashboardApproval": true
},
"stabilityDays": 3,
"prCreation": "not-pending",
"prConcurrentLimit": 5,
"timezone": "Europe/Berlin",
"schedule": ["before 5am on Wednesday"],
"packageRules": [
{
"matchPackagePatterns": ["*"],
"matchUpdateTypes": ["minor", "patch"],
"groupName": "all non-major dependencies",
"groupSlug": "all-minor-patch"
}
]
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"],
"labels": ["dependencies"],
"rangeStrategy": "replace",
"separateMajorMinor": true,
"dependencyDashboard": true,
"dependencyDashboardAutoclose": false,
"major": {
"dependencyDashboardApproval": true
},
"stabilityDays": 3,
"prCreation": "not-pending",
"prConcurrentLimit": 5,
"timezone": "Europe/Berlin",
"schedule": ["before 5am on Wednesday"],
"packageRules": [
{
"matchPackagePatterns": ["*"],
"matchUpdateTypes": ["minor", "patch"],
"groupName": "all non-major dependencies",
"groupSlug": "all-minor-patch"
}
]
}
4 changes: 2 additions & 2 deletions .husky/post-merge
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"

hasChanged() {
echo "$changedFiles" | grep -q "$1"
echo "$changedFiles" | grep -q "$1"
}

if hasChanged 'pnpm-lock.yaml'; then
pnpm install
pnpm install
fi
2 changes: 1 addition & 1 deletion .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
...require('@mheob/prettier-config'),
...require('@mheob/prettier-config'),
};
97 changes: 48 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
{
"name": "@mheob/config",
"version": "0.0.0",
"private": true,
"license": "MIT",
"workspaces": [
"packages/*"
],
"scripts": {
"changeset": "changeset",
"clean": "turbo run clean",
"clean:root": "rm -rf .turbo && rm -rf node_modules",
"format": "prettier --write \"**/*.{cjs,js,jsx,ts,tsx,json,md,mdx,yml}\"",
"lint": "turbo run lint",
"prepare": "ts-node ./scripts/prepare.ts",
"release": "changeset publish",
"sort-package-json": "pnpm dlx sort-package-json && turbo run sort-package-json",
"version-packages": "changeset version"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"lint-staged": {
"*.{cjs,js,jsx,ts,tsx}": "eslint --fix",
"!(pnpm-)*.{cjs,js,jsx,ts,tsx,json,md,mdx,yml,yaml}": "pnpm exec prettier --write",
"**/package.json": "pnpm dlx sort-package-json"
},
"devDependencies": {
"@changesets/cli": "^2.24.4",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@mheob/eslint-config": "workspace:*",
"@mheob/prettier-config": "workspace:*",
"@types/node": "^18.7.18",
"eslint": "^8.23.1",
"husky": "^8.0.0",
"is-ci": "^3.0.1",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"ts-node": "^10.9.1",
"turbo": "^1.4.6",
"typescript": "^4.8.3"
},
"packageManager": "pnpm@7.11.0",
"engines": {
"node": ">=16.0.0",
"npm": ">=8.0.0"
}
"name": "@mheob/config",
"version": "0.0.0",
"private": true,
"license": "MIT",
"workspaces": [
"packages/*"
],
"scripts": {
"changeset": "changeset",
"clean": "turbo run clean",
"clean:root": "rm -rf .turbo && rm -rf node_modules",
"format": "prettier --write \"**/*.{cjs,js,jsx,ts,tsx,json,md,mdx,yml}\"",
"lint": "turbo run lint",
"prepare": "ts-node ./scripts/prepare.ts",
"release": "changeset publish",
"sort-package-json": "pnpm dlx sort-package-json && turbo run sort-package-json",
"version-packages": "changeset version"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"lint-staged": {
"*.{cjs,js,jsx,ts,tsx}": "eslint --fix",
"!(pnpm-)*.{cjs,js,jsx,ts,tsx,json,md,mdx,yml,yaml}": "pnpm exec prettier --write",
"**/package.json": "pnpm dlx sort-package-json"
},
"devDependencies": {
"@changesets/cli": "^2.24.4",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@mheob/eslint-config": "workspace:*",
"@mheob/prettier-config": "workspace:*",
"@types/node": "^18.7.18",
"eslint": "^8.23.1",
"husky": "^8.0.0",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"ts-node": "^10.9.1",
"turbo": "^1.4.6",
"typescript": "^4.8.3"
},
"packageManager": "pnpm@7.11.0",
"engines": {
"node": ">=16.0.0",
"npm": ">=8.0.0"
}
}
10 changes: 5 additions & 5 deletions packages/eslint-config/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** @type {import('eslint').ESLint.ConfigData} */
module.exports = {
extends: ['./base.js'],
env: { node: true },
rules: {
'unicorn/prefer-module': 'off',
},
extends: ['./base.js'],
env: { node: true },
rules: {
'unicorn/prefer-module': 'off',
},
};
48 changes: 24 additions & 24 deletions packages/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ pnpm add -D @mheob/eslint-config
```js
// .eslintrc.cjs
module.exports = {
root: true, // optional
extends: ['@mheob/eslint-config'],
root: true, // optional
extends: ['@mheob/eslint-config'],
};
```

Expand All @@ -39,8 +39,8 @@ module.exports = {
```js
// .eslintrc.cjs
module.exports = {
root: true, // optional
extends: ['@mheob/eslint-config/react'],
root: true, // optional
extends: ['@mheob/eslint-config/react'],
};
```

Expand All @@ -49,8 +49,8 @@ module.exports = {
```js
// .eslintrc.cjs
module.exports = {
root: true, // optional
extends: ['@mheob/eslint-config/next'],
root: true, // optional
extends: ['@mheob/eslint-config/next'],
};
```

Expand All @@ -59,12 +59,12 @@ If you need to override some rules you can do it this way:
```js
// .eslintrc.cjs
module.exports = {
root: true, // optional
extends: ['@mheob/eslint-config'],
rules: {
'prettier/prettier': 'off',
'no-console': 'warn',
},
root: true, // optional
extends: ['@mheob/eslint-config'],
rules: {
'prettier/prettier': 'off',
'no-console': 'warn',
},
};
```

Expand All @@ -73,17 +73,17 @@ Or override rules specified for some files:
```js
// .eslintrc.cjs
module.exports = {
root: true, // optional
extends: ['@mheob/eslint-config'],
overrides: [
{
files: ['*.jsx', '*.tsx'],
settings: { react: { version: 'detect' } },
rules: {
'react/jsx-no-useless-fragment': 'warn',
'react/react-in-jsx-scope': 'off',
},
},
],
root: true, // optional
extends: ['@mheob/eslint-config'],
overrides: [
{
files: ['*.jsx', '*.tsx'],
settings: { react: { version: 'detect' } },
rules: {
'react/jsx-no-useless-fragment': 'warn',
'react/react-in-jsx-scope': 'off',
},
},
],
};
```
92 changes: 46 additions & 46 deletions packages/eslint-config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,50 @@
* @type {import('eslint').ESLint.ConfigData}
*/
module.exports = {
plugins: ['@typescript-eslint'],
extends: ['eslint:recommended', 'plugin:unicorn/recommended', 'plugin:prettier/recommended'],
rules: {
'prettier/prettier': 'warn',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-implicit-coercion': ['error', { allow: ['!!', '+', '~'] }],
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'unicorn/import-index': 'error',
'unicorn/prevent-abbreviations': [
'error',
{
replacements: {
args: false,
doc: false,
env: false,
props: false,
},
},
],
},
overrides: [
{
files: ['*.cjs'],
env: { node: true },
},
{
files: ['*.js', '*.ts'],
rules: { 'unicorn/filename-case': ['error', { case: 'camelCase' }] },
},
{
files: ['*.ts', '*.tsx'],
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-function-return-type': [
'warn',
{ allowExpressions: true, allowTypedFunctionExpressions: true },
],
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/quotes': ['warn', 'single', { avoidEscape: true }],
},
},
],
plugins: ['@typescript-eslint'],
extends: ['eslint:recommended', 'plugin:unicorn/recommended', 'plugin:prettier/recommended'],
rules: {
'prettier/prettier': 'warn',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-implicit-coercion': ['error', { allow: ['!!', '+', '~'] }],
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'unicorn/import-index': 'error',
'unicorn/prevent-abbreviations': [
'error',
{
replacements: {
args: false,
doc: false,
env: false,
props: false,
},
},
],
},
overrides: [
{
files: ['*.cjs'],
env: { node: true },
},
{
files: ['*.js', '*.ts'],
rules: { 'unicorn/filename-case': ['error', { case: 'camelCase' }] },
},
{
files: ['*.ts', '*.tsx'],
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-function-return-type': [
'warn',
{ allowExpressions: true, allowTypedFunctionExpressions: true },
],
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/quotes': ['warn', 'single', { avoidEscape: true }],
},
},
],
};
2 changes: 1 addition & 1 deletion packages/eslint-config/next.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* @type {import('eslint').ESLint.ConfigData}
*/
module.exports = {
extends: ['./react', 'next/core-web-vitals'],
extends: ['./react', 'next/core-web-vitals'],
};
Loading

0 comments on commit cf8ba94

Please sign in to comment.