@offchainlabs/eslint-config-typescript

0.2.2 • Public • Published

Eslint

Provide reusable typescript and react eslint configs

  1. Install the peerDependencies of eslint configs:
npx install-peerdeps -Y --dev @offchainlabs/eslint-config-typescript
  1. Usage

Eslint docs

eslintrc.js

require('@offchainlabs/eslint-config-typescript/base');
require('@offchainlabs/eslint-config-typescript/react');

module.exports = {
  extends: [
    '@offchainlabs/eslint-config-typescript/base',
    '@offchainlabs/eslint-config-typescript/react',
  ],
  // Override here
};

.eslintrc.yaml, .eslintrc.yml

extends:
  - '@offchainlabs/eslint-config-typescript/base'
  - '@offchainlabs/eslint-config-typescript/react'

rules:
  # Override here

.eslintrc.json

{
  extends: [
    '@offchainlabs/eslint-config-typescript/base',
    '@offchainlabs/eslint-config-typescript/react'
  ],
  overrides: [...]
}

package.json

"eslintConfig": {
  "extends": [
    "@offchainlabs/eslint-config-typescript/base",
    "@offchainlabs/eslint-config-typescript/react",
  ],
  "overrides": [...]
}

Note

For nextjs based project, "@offchainlabs/eslint-config-typescript/react" should be removed in favor of "@offchainlabs/eslint-config-typescript/next",. It includes react, react-hooks, jsx-a11y and import configurations already.

If you're using @offchainlabs/eslint-config-typescript/next in a project where Next.js isn't installed in your root directory (such as a monorepo), you need to update your .eslintrc:

{
  "extends": "next",
  "settings": {
    "next": {
      "rootDir": "packages/my-app/"
    }
  }
}

rootDir can be a path (relative or absolute), a glob (i.e. "packages/*/"), or an array of paths and/or globs.

see https://nextjs.org/docs/basic-features/eslint#rootdir

This repo can be linted with itself by running yarn run lint

Readme

Keywords

none

Package Sidebar

Install

Weekly Downloads

25

Version

0.2.2

License

MIT

Unpacked Size

6.25 kB

Total Files

9

Last publish

Collaborators

  • spsjvc
  • gzeon
  • dzgoldman
  • hkalodner