Skip to content

Files

Latest commit

1efccfc · Nov 10, 2023

History

History

xerox-eslint-config

@xerox/eslint-config

ESLint shareable configuration for Xerox projects.

ci status npm package license MIT commit style angular semantic-release

Usage

  1. Install this config and eslint as a devDependency:
yarn add eslint@5.12.1 @xerox/eslint-config --dev
# or
npm install eslint@5.12.1 @xerox/eslint-config --save-dev
  1. Extend the base and any additional configs in your .eslintrc file (or just add an eslintConfig entry to your package.json):
{
  "extends": [
    "@xerox",
    "@xerox/eslint-config/typescript", // Optional
    "@xerox/eslint-config/react" // Optional
    "@xerox/eslint-config/jest" // Optional
  ]
}

Configurations

xerox (base)

The base eslint configuration i.e. "extends": ["@xerox"] includes rules for Jest and Prettier, and some general preferences like linebreak-style.

xerox/typescript

The typescript eslint configuration i.e. "extends": ["@xerox/eslint-config/typescript"] includes various TypeScript related rules, as well as swapping the default parser in order for eslint to work with TypeScript. You should call eslint using --ext .js,.ts, add .jsx and/or .tsx if necessary. This also adds a JSDoc requirement for only TypeScript files, .js and test.{js,ts} files are excluded, this allows you to progressively convert from TS to JS without having to add JSdoc to all the old JS source. These JSDoc rules are setup to mimick TSDoc, eslint-plugin-tsdoc doesn't yet exist, so this is a workaround, try to follow the example set out here.

xerox/react

The react eslint configuration i.e. "extends": ["@xerox/eslint-config/react"] enables jsx and includes the react recommended settings from eslint-plugin-react, this sub-config needs some fleshing out.

xerox/jest

The jest eslint configuration i.e. "extends": ["@xerox/eslint-config/jest"] includes the jest recommended settings from eslint-plugin-jest.


LICENSE | CHANGELOG