Skip to content

Commit

Permalink
chore: remove prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyingchun committed May 29, 2024
1 parent e81785f commit 2bd7bcd
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default config;
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "keen-slider/keen-slider.min.css";
@import 'keen-slider/keen-slider.min.css';

* {
scroll-behavior: smooth;
Expand Down
19 changes: 0 additions & 19 deletions lint-staged.common.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import path from 'path';
import { quote } from 'shell-quote';

const isWin = process.platform === 'win32';

const eslintGlobalRulesForFix = [
// react-hooks/eslint and react in general is very strict about exhaustively
Expand Down Expand Up @@ -62,19 +59,3 @@ export const getEslintFixCmd = ({
].join(' ');
return `eslint ${args}`;
};

/**
* Concatenate and escape a list of filenames that can be passed as args to prettier cli
*
* Prettier has an issue with special characters in filenames,
* such as the ones uses for nextjs dynamic routes (ie: [id].tsx...)
*
* @link https://github.com/okonet/lint-staged/issues/676
*
* @param {string[]} filenames
* @returns {string} Return concatenated and escaped filenames
*/
export const concatFilesForPrettier = (filenames) =>
filenames
.map((filename) => `"${isWin ? filename : quote([filename])}"`)
.join(' ');
10 changes: 1 addition & 9 deletions lint-staged.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { fileURLToPath } from 'node:url';
* A good practice is to override this base configuration in each package and/or application
* where we are able to add customization depending on the nature of the project (eslint...).
*/
import {
concatFilesForPrettier,
getEslintFixCmd,
} from './lint-staged.common.mjs';
import { getEslintFixCmd } from './lint-staged.common.mjs';

/**
* @type {Record<string, (filenames: string[]) => string | string[] | Promise<string | string[]>>}
Expand All @@ -26,11 +23,6 @@ const rules = {
files: filenames,
});
},
'**/*.{json,md,mdx,css,html,yml,yaml,scss,ts,js,tsx,jsx,mjs}': (
filenames
) => {
return [`prettier --write ${concatFilesForPrettier(filenames)}`];
},
};

export default rules;
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"lint-staged": "15.2.5",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"shell-quote": "1.8.1",
"tsup": "^8.0.2",
"typescript": "^5.4.5",
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,6 @@ __metadata:
npm-run-all: "npm:^4.1.5"
postcss: "npm:^8.4.38"
postcss-js: "npm:^4.0.1"
prettier: "npm:^3.2.5"
sade: "npm:^1.8.1"
shell-quote: "npm:1.8.1"
tsup: "npm:^8.0.2"
Expand Down

0 comments on commit 2bd7bcd

Please sign in to comment.