@lqbach/eslint-config 0.3.4 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.0](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.3.4...eslint-config-v0.4.0) (2023-12-04)
4
+
5
+
6
+ ### Features 🚀
7
+
8
+ * add ignores parameter ([bd6a304](https://github.com/lqbach/eslint-prettier-config/commit/bd6a304555afa3b8371f3e22cf78ab6936d8770c))
9
+ * add README to `eslint-config` package ([#11](https://github.com/lqbach/eslint-prettier-config/issues/11)) ([8bcf82d](https://github.com/lqbach/eslint-prettier-config/commit/8bcf82dd94ceeb5f42e5807b46a682586e41b937))
10
+
3
11
  ## [0.3.4](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.3.3...eslint-config-v0.3.4) (2023-11-28)
4
12
 
5
13
 
package/README.md CHANGED
@@ -10,3 +10,103 @@
10
10
  <img src="https://img.shields.io/github/release-date/lqbach/eslint-prettier-config?labelColor=BDD4E7&color=444E5F" alt="release-date"/>
11
11
 
12
12
  </div>
13
+
14
+ - [Usage](#usage)
15
+ - [Installation](#installation)
16
+ - [pnpm](#pnpm)
17
+ - [yarn](#yarn)
18
+ - [npm](#npm)
19
+ - [Setup](#setup)
20
+ - [VSCode Support](#vscode-support)
21
+ - [Features](#features)
22
+ - [Ignoring Files](#ignoring-files)
23
+ - [React and Vue](#react-and-vue)
24
+
25
+ ## Usage
26
+
27
+ ### Installation
28
+
29
+ #### pnpm
30
+
31
+ ```
32
+ pnpm add -D @lqbach/eslint-config eslint
33
+ ```
34
+
35
+ #### yarn
36
+
37
+ ```
38
+ yarn add -D @lqbach/eslint-config eslint
39
+ ```
40
+
41
+ #### npm
42
+
43
+ ```
44
+ npm install -D @lqbach/eslint-config eslint
45
+ ```
46
+
47
+ ### Setup
48
+
49
+ This configuration file uses the new [flat ESLint Configuration](https://eslint.org/docs/latest/use/configure/configuration-files-new). Setting this up can be as seamless as one line of code.
50
+
51
+ ```js
52
+ // eslint.config.js
53
+ import eslintConfig from "@lqbach/eslint-config"
54
+
55
+ export default eslintConfig()
56
+ ```
57
+
58
+ > [!WARNING]
59
+ > ESLint flat configs don't really support `.eslintignore` files anymore. To ignore files, you should use the new global `ignores` that can be easily configured with this config library See [ignoring files](#ignoring-files) below.
60
+
61
+ ### VSCode Support
62
+
63
+ Visual Studio Code has an [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) (or search _`dbaeumer.vscode-eslint`_ in the Extension Marketplace search bar) that supports rich editing features. This will help lint file saves and provide linting documentation in the code.
64
+ The following should be added to `.vscode/settings.json` at the root of your project:
65
+
66
+ ```json
67
+ {
68
+ // Include the below if using Prettier
69
+ // "editor.formatOnSave": true,
70
+
71
+ // Tell the ESLint plugin to run on save
72
+ "editor.codeActionsOnSave": {
73
+ "source.fixAll.eslint": true
74
+ },
75
+
76
+ // To enable proper ESLint behavior with flat configurations
77
+ "eslint.experimental.useFlatConfig": true
78
+ }
79
+ ```
80
+
81
+ ## Features
82
+
83
+ ### Ignoring Files
84
+
85
+ You can ignore files by using the `ignores` parameter which accepts an array of strings. Reference the [ignore patterns](https://eslint.org/docs/latest/use/configure/ignore) from the ESLint documentation for proper glob syntax.
86
+
87
+ ```js
88
+ // eslint.config.js
89
+ import eslintConfig from "@lqbach/eslint-config"
90
+
91
+ export default eslintConfig({
92
+ ignores: ["./sanity", "./public/*.js"],
93
+ })
94
+ ```
95
+
96
+ The above will ignore the `sanity` folder and all JavaScript files in the `public` folder.
97
+
98
+ ### React and Vue
99
+
100
+ If you are writing with React or Vue, you will need to toggle them on. Both `vue` and `react` parameters default to `false` until set by the user.
101
+
102
+ ```js
103
+ // eslint.config.js
104
+ import eslintConfig from "@lqbach/eslint-config"
105
+
106
+ export default eslintConfig({
107
+ vue: true, // defaults to false
108
+
109
+ // uncomment below and comment above to use react
110
+ // react: true,
111
+ })
112
+ ```
package/dist/index.cjs CHANGED
@@ -369,7 +369,8 @@ function config(params = {}) {
369
369
  "**/.cache",
370
370
  "**/.output",
371
371
  "**/*.min.*",
372
- "**/LICENSE*"
372
+ "**/LICENSE*",
373
+ ...params.ignores ? params.ignores : []
373
374
  ]
374
375
  };
375
376
  const javascriptConfig = [
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  interface ConfigParams {
2
+ ignores?: Array<string>;
2
3
  json?: boolean;
3
4
  markdown?: boolean;
4
5
  perfectionist?: boolean;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  interface ConfigParams {
2
+ ignores?: Array<string>;
2
3
  json?: boolean;
3
4
  markdown?: boolean;
4
5
  perfectionist?: boolean;
package/dist/index.js CHANGED
@@ -358,7 +358,8 @@ function config(params = {}) {
358
358
  "**/.cache",
359
359
  "**/.output",
360
360
  "**/*.min.*",
361
- "**/LICENSE*"
361
+ "**/LICENSE*",
362
+ ...params.ignores ? params.ignores : []
362
363
  ]
363
364
  };
364
365
  const javascriptConfig = [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lqbach/eslint-config",
3
3
  "type": "module",
4
- "version": "0.3.4",
4
+ "version": "0.4.0",
5
5
  "description": "lqbach's Personal Eslint Config",
6
6
  "private": false,
7
7
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "vue-eslint-parser": "^9.3.2",
35
35
  "yaml-eslint-parser": "^1.2.2"
36
36
  },
37
- "devDependencies": {
37
+ "peerDependencies": {
38
38
  "eslint": "^8.53.0"
39
39
  },
40
40
  "scripts": {
package/src/index.ts CHANGED
@@ -41,6 +41,7 @@ export default function config(params: ConfigParams = {}): Array<ConfigObject> {
41
41
 
42
42
  "**/*.min.*",
43
43
  "**/LICENSE*",
44
+ ...(params.ignores ? params.ignores : []),
44
45
  ],
45
46
  }
46
47
 
package/src/types.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export interface ConfigParams {
2
+ ignores?: Array<string>
2
3
  json?: boolean
3
4
  markdown?: boolean
4
5
  perfectionist?: boolean