eslint-config-plus-prettier 4.1.8 → 4.1.10

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/README.md CHANGED
@@ -1,26 +1,30 @@
1
1
  # eslint-config-plus-prettier
2
2
 
3
- Standard config for ESLint, Prettier and Package Lint. Also includes an optional TSConfig.
3
+ > Standard config for ESLint, Prettier and Package Lint. Also includes an optional TSConfig.
4
4
 
5
- ## Install
5
+ ## Quick Setup
6
+
7
+ Install the package:
6
8
 
7
9
  ```bash
8
- npm install --save-dev eslint-config-plus-prettier
10
+ npm install --save-dev --save-exact eslint-config-plus-prettier
9
11
  ```
10
12
 
11
13
  Add the following scripts to your `package.json`:
12
14
 
13
15
  ```json
14
- "scripts": {
15
- "format": "prettier --write .",
16
- "format:check": "prettier --check .",
17
- "lint": "eslint --fix",
18
- "lint:check": "eslint",
19
- "package:lint": "npx npm-package-json-lint ."
20
- }
16
+ {
17
+ "scripts": {
18
+ "format": "prettier --write .",
19
+ "format:check": "prettier --check .",
20
+ "lint": "eslint --fix",
21
+ "lint:check": "eslint",
22
+ "package:lint": "npx npm-package-json-lint ."
23
+ }
24
+ }
21
25
  ```
22
26
 
23
- ### Configure ESLint
27
+ ## Configuration
24
28
 
25
29
  Add a `eslint.config.js` file with the following:
26
30
 
@@ -36,26 +40,29 @@ Consider adding a `.eslintignore` file to avoid trying to lint compiled code in
36
40
  dist
37
41
  ```
38
42
 
39
- ### Configure Prettier
43
+ ### Prettier
40
44
 
41
- Add prettier config to `package.json`:
45
+ Add prettier configuration to your `package.json`:
42
46
 
43
47
  ```json
44
- "prettier": "eslint-config-plus-prettier/prettier"
48
+ {
49
+ "prettier": "eslint-config-plus-prettier/prettier"
50
+ }
45
51
  ```
46
52
 
47
- Consider adding a `.prettierignore` file to avoid formatting generated files:
53
+ **Optional**: Create a `.prettierignore` file to exclude generated files:
48
54
 
49
55
  ```text
50
56
  package-lock.json
51
57
  CHANGELOG.md
58
+ dist
52
59
  ```
53
60
 
54
- ### Configure Package Lint
61
+ ### Package Lint
55
62
 
56
- Add a `.npmpackagejsonlintrc.json` file with the following:
63
+ Create a `.npmpackagejsonlintrc.json` file in your project root:
57
64
 
58
- If you are working on a module:
65
+ **For npm modules/libraries:**
59
66
 
60
67
  ```json
61
68
  {
@@ -63,7 +70,7 @@ If you are working on a module:
63
70
  }
64
71
  ```
65
72
 
66
- If you are working on a server, that needs fixed dependencies:
73
+ **For applications/servers (with fixed dependencies):**
67
74
 
68
75
  ```json
69
76
  {
@@ -71,28 +78,84 @@ If you are working on a server, that needs fixed dependencies:
71
78
  }
72
79
  ```
73
80
 
74
- ### Configure TSConfig (optional)
81
+ ### TypeScript (Optional)
75
82
 
76
- Add a `tsconfig.json` file with the following:
83
+ Create a `tsconfig.json` file for TypeScript projects:
77
84
 
78
85
  ```json
79
86
  {
80
87
  "extends": "eslint-config-plus-prettier/tsconfig",
81
- "include": ["src"], // Files to be compiled
88
+ "include": ["src/**/*"],
82
89
  "compilerOptions": {
83
- "outDir": "dist" // Compiled directory
90
+ "outDir": "dist"
84
91
  }
85
92
  }
86
93
  ```
87
94
 
88
- ## Use
95
+ ## Usage
96
+
97
+ Run the following commands to lint and format your code:
89
98
 
90
99
  ```bash
100
+ # Lint and auto-fix JavaScript/TypeScript files
91
101
  npm run lint
102
+
103
+ # Format all files with Prettier
92
104
  npm run format
105
+
106
+ # Validate package.json structure
93
107
  npm run package:lint
108
+
109
+ # Check formatting without making changes
110
+ npm run format:check
111
+
112
+ # Check linting without auto-fixing
113
+ npm run lint:check
94
114
  ```
95
115
 
96
- - `lint` will check for errors and fix formatting in `.ts` and `.js` files.
97
- - `format` will apply format rules to all possible files.
98
- - `package:lint` will warn of any inconsistencies in the `package.json` file.
116
+ ## What's Included
117
+
118
+ ### ESLint Rules
119
+
120
+ - **TypeScript support** with `@typescript-eslint` parser and plugin
121
+ - **Import sorting** with `simple-import-sort` plugin
122
+ - **Unused import removal** with `unused-imports` plugin
123
+ - **Consistent quotes** (double quotes)
124
+ - **Prefer const** for immutable variables
125
+ - **Unused variable warnings** (with underscore prefix exception)
126
+
127
+ ### Prettier Configuration
128
+
129
+ - **Double quotes** for strings
130
+ - **Semicolons** enabled
131
+ - **Trailing commas** in ES5-compatible locations
132
+ - **120 character** line width
133
+ - **2 spaces** for indentation
134
+
135
+ ### Package Lint Rules
136
+
137
+ - Validates `package.json` structure and dependencies
138
+ - Different rulesets for modules vs. applications
139
+ - Ensures consistent package metadata
140
+
141
+ ## Troubleshooting
142
+
143
+ ### ESLint Issues
144
+
145
+ - Make sure you're using ESLint v9+ for flat config support
146
+ - Check that your `eslint.config.js` is in the project root
147
+ - Verify all files you want to lint match the file patterns
148
+
149
+ ### Prettier Conflicts
150
+
151
+ - This config uses `eslint-config-prettier` to disable conflicting ESLint rules
152
+ - If you see formatting conflicts, check your `.prettierignore` file
153
+
154
+ ### Import Errors
155
+
156
+ - Ensure you're using ES modules (`"type": "module"` in package.json)
157
+ - For CommonJS projects, use `.cjs` extension for config files
158
+
159
+ ## Contributing
160
+
161
+ Found an issue or have a suggestion? Please [open an issue](https://github.com/aimeerivers/eslint-config-plus-prettier/issues) or submit a pull request.
package/eslint.config.js CHANGED
@@ -16,15 +16,6 @@ export default {
16
16
  files: ["**/*.ts", "**/*.js"],
17
17
  rules: {
18
18
  "@typescript-eslint/no-floating-promises": ["off"],
19
- "@typescript-eslint/no-unused-vars": [
20
- "warn",
21
- {
22
- vars: "all",
23
- varsIgnorePattern: "^_",
24
- args: "after-used",
25
- argsIgnorePattern: "^_",
26
- },
27
- ],
28
19
  "prefer-const": [
29
20
  "error",
30
21
  {
@@ -36,5 +27,6 @@ export default {
36
27
  "simple-import-sort/exports": "error",
37
28
  quotes: ["error", "double"],
38
29
  "unused-imports/no-unused-imports": "warn",
30
+ "no-unused-vars": "warn",
39
31
  },
40
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-plus-prettier",
3
- "version": "4.1.8",
3
+ "version": "4.1.10",
4
4
  "description": "Standard config for ESLint, Prettier and Package Lint. Also includes an optional TSConfig.",
5
5
  "license": "ISC",
6
6
  "author": "aimee rivers",
@@ -31,12 +31,12 @@
31
31
  "package:lint": "npx npm-package-json-lint ."
32
32
  },
33
33
  "dependencies": {
34
- "@typescript-eslint/eslint-plugin": "^8.29.1",
35
- "@typescript-eslint/parser": "^8.29.1",
36
- "eslint": "^9.24.0",
37
- "eslint-config-prettier": "^9.1.0",
34
+ "@typescript-eslint/eslint-plugin": "^8.33.1",
35
+ "@typescript-eslint/parser": "^8.33.1",
36
+ "eslint": "^9.28.0",
37
+ "eslint-config-prettier": "^10.1.5",
38
38
  "eslint-plugin-import": "^2.31.0",
39
- "eslint-plugin-prettier": "^5.2.6",
39
+ "eslint-plugin-prettier": "^5.4.1",
40
40
  "eslint-plugin-promise": "^7.2.1",
41
41
  "eslint-plugin-simple-import-sort": "^12.1.1",
42
42
  "eslint-plugin-unused-imports": "^4.1.4",