twolfson-style
raw JSON → 1.6.1 verified Fri May 01 auth: no javascript deprecated
Lint and style configurations for @twolfson, providing a common versioned location for style choices. Version 1.6.1 is the latest stable release, with a low release cadence. It integrates jscs and jshint, offering a CLI to install .jscsrc and .jshintrc files, lint paths, and run prechecks. It does not include jscs/jshint as dependencies, relying on the user to provide them. Alternative: self-managed configs.
Common errors
error twolfson-style: command not found ↓
cause twolfson-style not installed or not in PATH
fix
Run 'npm install twolfson-style --save-dev' and use npx or local node_modules/.bin/
error jshint: command not found ↓
cause jshint not installed
fix
Install jshint: 'npm install jshint --save-dev'
error jscs: command not found ↓
cause jscs not installed
fix
Install jscs: 'npm install jscs --save-dev'
error Error: Cannot find module 'twolfson-style' ↓
cause Module not resolved
fix
Ensure twolfson-style is installed: 'npm install twolfson-style'
Warnings
deprecated Package is no longer actively maintained; jscs itself is deprecated in favor of ESLint. ↓
fix Migrate to ESLint with a preset like eslint-config-airbnb.
deprecated jscs is deprecated; jshint is legacy. ↓
fix Use ESLint instead of jscs/jshint.
gotcha twolfson-style does not install jshint or jscs; they must be in $PATH or installed separately. ↓
fix Install jshint and jscs globally or as devDependencies.
gotcha The 'lint' command runs both jshint and jscs; if either fails, the command fails. ↓
fix Ensure both tools are configured correctly.
Install
npm install twolfson-style yarn add twolfson-style pnpm add twolfson-style Imports
- twolfson-style
import { twolfsonStyle } from 'twolfson-style' - default wrong
import twolfsonStyle from 'twolfson-style'correctconst twolfsonStyle = require('twolfson-style') - jscsrc wrong
import jscsrc from 'twolfson-style/.jscsrc'correctrequire('twolfson-style/.jscsrc') - jshintrc wrong
import jshintrc from 'twolfson-style/.jshintrc'correctrequire('twolfson-style/.jshintrc')
Quickstart
npm install twolfson-style
./node_modules/.bin/twolfson-style install
ls .jscsrc .jshintrc
# Add to package.json scripts:
# "lint": "twolfson-style lint lib/ test/"
# "precheck": "twolfson-style precheck lib/ test/"