Registry / devops / bsg
library2.0.5jsnpmunverified

BSG is an all-in-one linting tool for BSG-FE frontend teams, version 2.0.5. It integrates ESLint, Prettier, Stylelint, ls-lint, lint-staged, commitlint, and changelog generation to enforce unified code style, naming conventions, and commit message formats. The tool provides zero-config defaults for multiple file types (.js, .ts, .vue, .css, .scss, etc.) and supports both manual linting and Git hooks for automated checking. It differs from alternatives by being a complete, opinionated solution tailored to a specific organization, reducing project setup overhead and ensuring consistency across projects and developers. Release cadence is not specified.

npm install bsg
INSTALL
IMPORT
SIG · BSG
B
bsg
devopsjavascriptv2.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

bsg
import bsg from 'bsg'
const bsg = require('bsg')
The package is ESM-only; CommonJS require() will not work. However, it is typically used as a CLI tool via 'npx bsg' or script commands.
bsg (CLI)
npx bsg lint-staged
npm run bsg lint-staged
The bsg tool is primarily used as a CLI executable. Run it directly via npx, not as an npm script step.
.eslintrc.js (from bsg)
const config = require('bsg/.eslintrc.js')
import config from 'bsg/.eslintrc'
The ESLint config is a CommonJS file; use require() even if your project uses ESM. Also, the path must include the extension.

Shows full setup: install bsg and husky, add lint script, run lint, set up pre-commit and commit-msg hooks, and optional interactive commit guide.

npm install -D bsg husky # Add lint script to package.json npm pkg set scripts.lint="bsg lint" # Run lint npm run lint # Setup Husky hooks npm run prepare npx husky add .husky/pre-commit "npx --no-install bsg lint-staged" # Add commitlint hook npx husky add .husky/commit-msg "npx --no-install bsg commitlint" # Commit with guide (optional) npm pkg set scripts.commit="bsg commit"
Debug
Known issues
breakingBefore installing, you must uninstall ESLint, Stylelint, and related devDependencies, and delete their config files (e.g., .eslintrc.js, stylelint.config.js). Also remove outdates webpack linters like eslint-loader.
fix
Run 'npm uninstall eslint stylelint eslint-loader' and manually delete config files.
affects: *
gotchaThe changelog generator relies on Git tags. If tags are missing or inconsistent, the CHANGELOG.md will be incomplete or contain duplicate entries. Use '-r 0' for initial generation.
fix
Ensure all releases have proper Git tags. For first-time generation: 'npx bsg changelog -r 0'.
affects: *
gotchaGerrit users: commit-msg hook must include Gerrit's own hook script after bsg's commitlint to avoid submission errors.
fix
Edit .husky/commit-msg to append: 'if [ -f .git/hooks/commit-msg ]; then . .git/hooks/commit-msg; fi'.
affects: *
gotchaIf you encounter 'git exited with error code 1' during commit, ensure 'core.commentChar' is set in Git config.
fix
Run 'git config --local core.commentChar '#' to set a comment character.
affects: *
deprecatedThe package is an internal BSG-FE tool; there is no public roadmap or community support. External users should avoid relying on it.
fix
Consider using alternative tools like ESLint, Prettier, commitlint, and standard-version separately.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'bsg'
Missing local installation or incorrect import path.
fix
Run 'npm install -D bsg' in the project root. For CLI usage, use 'npx bsg' to invoke locally installed package.
npm ERR! code ERESOLVE unable to resolve dependency tree
Mismatched peer dependencies (e.g., conflicting versions of ESLint or Prettier).
fix
Delete node_modules and package-lock.json, then run 'npm install --legacy-peer-deps' or 'npm install --force'.
husky install: command not found
Husky not installed or not in PATH.
fix
Ensure husky is installed: 'npm install -D husky'. If PATH issue, add '.husky' directory and run 'npx husky install'.
> bsg lint-staged : Command failed with exit code 1
Syntax or style errors found in staged files during pre-commit hook.
fix
Fix the reported errors and re-stage the files. To see full details, run 'npx bsg lint' directly.
Error: Unable to load config file 'node_modules/bsg/.eslintrc.js'
File not found or permission issue.
fix
Check that bsg is installed and node_modules/bsg exists. If using VS Code settings, ensure path is correct relative to workspace root.
Upgrade
Version history
2.0.5latest on npm
Audit
Dependencies
huskyoptionalRequired for Git hooks (pre-commit and commit-msg) to automate linting and commitlint checks.
Agent activity
12 hits · last 30 days
node
12
Resources
packagebsg
bsg — npm install bsg · libregistry