eslint-config-terrax 0.3.0-next.1bdeff6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +80 -26
  2. package/package.json +1 -2
package/README.md CHANGED
@@ -1,13 +1,14 @@
1
+ <div align="center">
2
+
1
3
  # Terrax ESLint Config
2
4
 
3
- <div align="center">
4
- <br />
5
- <p>
6
- <a href="https://www.npmjs.com/package/eslint-config-terrax"><img src="https://img.shields.io/npm/v/eslint-config-terrax.svg?maxAge=3600&logo=npm&style=for-the-badge" alt="npm version" /></a>
7
- <a href="https://www.npmjs.com/package/eslint-config-terrax"><img src="https://img.shields.io/npm/dt/eslint-config-terrax.svg?maxAge=3600&logo=npm&style=for-the-badge" alt="npm downloads" /></a>
8
- </p>
5
+ [![npm version](https://img.shields.io/npm/v/eslint-config-terrax.svg?maxAge=3600&logo=npm&style=for-the-badge)](https://www.npmjs.com/package/eslint-config-terrax)
6
+ [![npm downloads](https://img.shields.io/npm/dt/eslint-config-terrax.svg?maxAge=3600&logo=npm&style=for-the-badge)](https://www.npmjs.com/package/eslint-config-terrax)
7
+
9
8
  </div>
10
9
 
10
+ _This config was inspired by [eslint-config-neon](https://github.com/iCrawl/eslint-config-neon) and [eslint-config-tesseract](https://github.com/MenuDocs/eslint-config-tesseract)._
11
+
11
12
  ## Installation
12
13
 
13
14
  terrax comes as a complete package, none of the configs require any additional dependecies.
@@ -18,30 +19,83 @@ yarn add eslint eslint-config-terrax
18
19
  pnpm add eslint eslint-config-terrax
19
20
  ```
20
21
 
21
- > [!IMPORTANT]
22
- > **Flat Config only**
23
- >
24
- > It is important to note that this package only exports [ESLint Flat Config][]! This means that you _have_ to use `eslint.config.js`, `eslint.config.mjs`, or `eslint.config.cjs` to use this package. See the ESLint documentation on flat config for more information.
22
+ ## Usage
23
+
24
+ This package includes the following configurations:
25
+
26
+ - [`eslint-config-terrax/common`](./src/common.ts) – The terrax code style guide.
27
+ - [`eslint-config-terrax/browser`](./src/browser.ts) – for usage with DOM and other browser APIs.
28
+ - [`eslint-config-terrax/jsx`](./src/jsx.ts) – for usage with [JSX](https://reactjs.org/docs/introducing-jsx.html) (with or without [React](https://reactjs.org/)).
29
+ - [`eslint-config-terrax/jsx-a11y`](./src/jsx-a11y.ts) – for usage with [JSX](https://facebook.github.io/react/) (with or without [React](https://reactjs.org/)) and want to include [accessibility checks](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y).
30
+ - [`eslint-config-terrax/next`](./src/next.ts) – for usage with [Next.js](https://nextjs.org/).
31
+ - [`eslint-config-terrax/react`](./src/react.ts) – for usage with [React](https://reactjs.org/).
32
+ - [`eslint-config-terrax/typescript`](./src/typescript.ts) – for usage with [TypeScript](http://typescriptlang.org/).
33
+
34
+ ### Notes
35
+
36
+ #### Flat Config only
37
+
38
+ It is important to note that this package only exports [ESLint Flat Config][]! This means that you _have_ to use `eslint.config.js`, `eslint.config.mjs`, or `eslint.config.cjs` to use this package. See the ESLint documentation on flat config for more information.
39
+
40
+ #### Merging Configs
25
41
 
26
- ## Configuration
42
+ In the examples below you will see `lodash.merge` being used. This is of vital importance as objects often have to be deeply merged when using ESLint Flat Config. If you don't merge the objects, you will overwrite the previous object with the new one, and your config will be invalid.
43
+
44
+ ### Configuration
45
+
46
+ #### Node.js
27
47
 
28
48
  ```js
29
- import { common, stylistic, typescript, prettier } from 'eslint-config-terrax';
30
-
31
- export default [
32
- {
33
- ignore: ['**/dist/*']
34
- },
35
- ...common,
36
- ...typescript,
37
- ...stylistic,
38
- {
39
- languageOptions: {
40
- project: './tsconfig.json'
41
- }
42
- },
43
- ...prettier
49
+ import { common, typescript } from 'eslint-config-terrax';
50
+ import merge from 'lodash.merge';
51
+
52
+ /**
53
+ * @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray}
54
+ */
55
+ const config = [
56
+ ...[...common, ...typescript].map((config) =>
57
+ merge(config, {
58
+ files: ['src/**/*.ts'],
59
+ languageOptions: {
60
+ parserOptions: {
61
+ project: 'tsconfig.eslint.json'
62
+ }
63
+ }
64
+ })
65
+ )
44
66
  ];
67
+
68
+ export default config;
69
+ ```
70
+
71
+ #### Next.js
72
+
73
+ ```js
74
+ import { browser, common, next, react, typescript } from 'eslint-config-terrax';
75
+ import merge from 'lodash.merge';
76
+
77
+ /**
78
+ * @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray}
79
+ */
80
+ const config = [
81
+ ...[...common, ...browser, ...typescript, ...react, ...next].map((config) =>
82
+ merge(config, {
83
+ files: ['src/**/*.ts'],
84
+ settings: {
85
+ react: {
86
+ version: 'detect'
87
+ }
88
+ },
89
+ languageOptions: {
90
+ parserOptions: {
91
+ project: 'tsconfig.json'
92
+ }
93
+ }
94
+ })
95
+ )
96
+ ];
97
+
98
+ export default config;
45
99
  ```
46
100
 
47
101
  [ESLint Flat Config]: https://eslint.org/blog/2022/08/new-config-system-part-2/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-terrax",
3
- "version": "0.3.0-next.1bdeff6",
3
+ "version": "0.3.0",
4
4
  "description": "The ESLint shareable config",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/common.cjs",
@@ -104,7 +104,6 @@
104
104
  "bugs": {
105
105
  "url": "https://github.com/rygent/eslint-config-terrax/issues"
106
106
  },
107
- "funding": "https://github.com/rygent/eslint-config-terrax?sponsor",
108
107
  "dependencies": {
109
108
  "@eslint/compat": "^1.2.2",
110
109
  "@eslint/js": "^9.14.0",