From 86133c736f2ad8278828e5e80687d66c0ee99ae2 Mon Sep 17 00:00:00 2001 From: 3y3 <3y3@ya.ru> Date: Sun, 11 Aug 2024 04:49:56 +0300 Subject: [PATCH] fix: Proxy all lint binary --- bin/eslint | 11 +++++++++++ bin/lint-staged | 11 +++++++++++ bin/prettier | 11 +++++++++++ bin/stylelint | 11 +++++++++++ bin/svgo | 11 +++++++++++ package.json | 7 ++++++- 6 files changed, 61 insertions(+), 1 deletion(-) create mode 100755 bin/eslint create mode 100755 bin/lint-staged create mode 100755 bin/prettier create mode 100755 bin/stylelint create mode 100755 bin/svgo diff --git a/bin/eslint b/bin/eslint new file mode 100755 index 0000000..0471f53 --- /dev/null +++ b/bin/eslint @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +BINDIR=$(dirname $(node -pe "require.resolve('eslint/package.json')")) + +if [[ -z "$BINDIR" ]]; then + echo "Required package 'eslint' not found" + exit 1 +fi + +# Redirect to original eslint bin +$BINDIR/bin/eslint.js $@ \ No newline at end of file diff --git a/bin/lint-staged b/bin/lint-staged new file mode 100755 index 0000000..1b1390d --- /dev/null +++ b/bin/lint-staged @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +BINDIR=$(dirname $(node -pe "require.resolve('lint-staged/package.json')")) + +if [[ -z "$BINDIR" ]]; then + echo "Required package 'lint-staged' not found" + exit 1 +fi + +# Redirect to original lint-staged bin +$BINDIR/bin/lint-staged.js $@ \ No newline at end of file diff --git a/bin/prettier b/bin/prettier new file mode 100755 index 0000000..889d62f --- /dev/null +++ b/bin/prettier @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +BINDIR=$(dirname $(node -pe "require.resolve('prettier')")) + +if [[ -z "$BINDIR" ]]; then + echo "Required package 'prettier' not found" + exit 1 +fi + +# Redirect to original prettier bin +$BINDIR/bin/prettier.cjs $@ \ No newline at end of file diff --git a/bin/stylelint b/bin/stylelint new file mode 100755 index 0000000..9b16901 --- /dev/null +++ b/bin/stylelint @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +BINDIR=$(dirname $(node -pe "require.resolve('stylelint/package.json')")) + +if [[ -z "$BINDIR" ]]; then + echo "Required package 'stylelint' not found" + exit 1 +fi + +# Redirect to original stylelint bin +$BINDIR/bin/stylelint.mjs $@ \ No newline at end of file diff --git a/bin/svgo b/bin/svgo new file mode 100755 index 0000000..515e45e --- /dev/null +++ b/bin/svgo @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +BINDIR=$(dirname $(node -pe "require.resolve('svgo/package.json')")) + +if [[ -z "$BINDIR" ]]; then + echo "Required package 'svgo' not found" + exit 1 +fi + +# Redirect to original svgo bin +$BINDIR/bin/svgo $@ \ No newline at end of file diff --git a/package.json b/package.json index df6b9df..08b39d4 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,12 @@ "description": "Diplodoc platform internal utility set for linting", "bin": { "lint": "./bin/lint", - "husky": "./bin/husky" + "husky": "./bin/husky", + "eslint": "./bin/eslint", + "prettier": "./bin/prettier", + "stylelint": "./bin/stylelint", + "lint-staged": "./bin/lint-staged", + "svgo": "./bin/svgo" }, "scripts": { "test": "cd test && npm start"