45.0.0 • Published 6 months ago

@zendeskgarden/eslint-config v45.0.0

Weekly downloads
298
License
Apache-2.0
Repository
github
Last release
6 months ago

Garden ESLint Config npm version Build Status

:seedling: Garden is the design system by Zendesk

This package exposes a shareable ESLint config and a selection of associated plugins.

Installation

npm install eslint @zendeskgarden/eslint-config

Usage

Add a eslint.config.mjs to your project like this:

import config from '@zendeskgarden/eslint-config';

export default config;

Now Garden linting rules will apply to your project. See the ESLint Documentation for more details on using shareable configuration files.

Plugins

The following shared plugins are also available.

Jest

Install the following dependency in addition to those listed above.

npm install jest

Update the default configuration.

import config from '@zendeskgarden/eslint-config';
import jestPlugin from '@zendeskgarden/eslint-config/plugins/jest.js';

export default [...config, jestPlugin];

In some cases, it may be useful to limit the scope of the Jest rules via files.

export default [
  ...config,
  {
    files: ['**/*.spec.*'],
    ...jestPlugin
  }
];

React

The React plugin bundles rules for React, React Hooks, and JSX accessibility. Install the following dependency in addition to those listed above.

npm install react

Update the default configuration.

import config from '@zendeskgarden/eslint-config';
import reactPlugin from '@zendeskgarden/eslint-config/plugins/react.js';

export default [...config, reactPlugin];

TypeScript

Install the following dependency in addition to those listed above.

npm install typescript

Update the default configuration.

import config from '@zendeskgarden/eslint-config';
import typescriptPlugin from '@zendeskgarden/eslint-config/plugins/typescript.js';

export default [...config, typescriptPlugin];

For mixed JS and TS codebases, it may be useful to limit the scope of the TypeScript rules via files.

export default [
  ...config,
  {
    files: ['**/*.{ts, tsx}'],
    ...typescriptPlugin
  }
];

The typescript plugin covers rules for syntax checking. An additional typescript-type-checked plugin provides rules based on semantics. The typescript-type-checked plugin requires type information in order to execute. Set languageOptions.parserOptions.project to a valid TSConfig for the project. See typescript-eslint documentation for details.

export default [
  ...config,
  typescriptPlugin,
  typescriptTypeCheckedPlugin,
  {
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.json'],
        requireConfigFile: false
      }
    }
  }
];

Resources

Shout-outs for a mostly reasonable set of lint rules go to:

Contribution

Thanks for your interest in Garden! Community involvement helps make our design system fresh and tasty for everyone.

Got issues with what you find here? Please feel free to create an issue.

If you'd like to take a crack at making some changes, please follow our contributing documentation for details needed to submit a PR.

Community behavior is benevolently ruled by a code of conduct. Please participate accordingly.

License

Copyright 2024 Zendesk

Licensed under the Apache License, Version 2.0

45.0.0

6 months ago

44.0.1

9 months ago

44.0.0

9 months ago

43.0.0

10 months ago

42.0.0

12 months ago

41.0.0

1 year ago

40.0.0

1 year ago

39.0.1

1 year ago

39.0.0

1 year ago

38.0.0

1 year ago

37.0.0

1 year ago

36.0.0

1 year ago

35.0.0

2 years ago

34.0.0

2 years ago

33.0.0

2 years ago

29.0.0

3 years ago

32.0.0

2 years ago

28.0.0

3 years ago

31.0.0

2 years ago

30.0.0

3 years ago

26.0.0

4 years ago

27.0.0

3 years ago

27.0.1

3 years ago

25.0.0

4 years ago

24.0.0

4 years ago

23.0.0

4 years ago

22.0.0

4 years ago

21.0.0

4 years ago

20.0.0

4 years ago

19.0.0

4 years ago

18.0.0

4 years ago

17.1.0

4 years ago

17.0.0

4 years ago

16.0.0

5 years ago

15.0.0

5 years ago

14.0.1

5 years ago

14.0.0

5 years ago

13.0.0

5 years ago

12.0.1

5 years ago

12.0.0

5 years ago

11.0.4

5 years ago

11.0.3

5 years ago

11.0.1

5 years ago

11.0.0

6 years ago

10.0.0

6 years ago

9.0.0

6 years ago

8.0.0

6 years ago

7.2.2

6 years ago

7.2.1

6 years ago

7.2.0

6 years ago

7.1.2

6 years ago

7.1.1

6 years ago

7.1.0

6 years ago

7.0.10

7 years ago

7.0.9

7 years ago

7.0.8

7 years ago

7.0.7

7 years ago

7.0.6

7 years ago

7.0.5

7 years ago

7.0.4

7 years ago

7.0.3

7 years ago

7.0.2

7 years ago

7.0.1

7 years ago

7.0.0

7 years ago

6.0.0

7 years ago

5.0.2

7 years ago

5.0.1

7 years ago

5.0.0

7 years ago