@mlaursen/eslint-config 1.4.0 → 1.7.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/.env.github ADDED
@@ -0,0 +1,2 @@
1
+ GITHUB_TOKEN=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
2
+
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.7.0](https://github.com/mlaursen/eslint-config/compare/v1.6.0...v1.7.0) (2022-06-28)
6
+
7
+
8
+ ### Features
9
+
10
+ * **deps:** bump dependencies to latest ([70fac92](https://github.com/mlaursen/eslint-config/commit/70fac9240155afd9ea065d7373fa776c965bf3fd))
11
+
12
+ ## [1.6.0](https://github.com/mlaursen/eslint-config/compare/v1.5.0...v1.6.0) (2022-03-24)
13
+
14
+
15
+ ### Features
16
+
17
+ * **typescript:** disable @typescript-eslint/consistent-type-imports ([1720116](https://github.com/mlaursen/eslint-config/commit/17201169a3a454901b69226312a0f29174f876a5))
18
+
19
+ ## [1.5.0](https://github.com/mlaursen/eslint-config/compare/v1.4.0...v1.5.0) (2022-03-09)
20
+
21
+
22
+ ### Features
23
+
24
+ * force braces ([f6d3f69](https://github.com/mlaursen/eslint-config/commit/f6d3f69cb8644746f7db8e6d562fbdd3a20c8d19))
25
+ * Force consistent type imports for typescript 3.8 or greater ([880217f](https://github.com/mlaursen/eslint-config/commit/880217fb7ad258acc6601218bb649c0928d97ade))
26
+ * Upgrade eslint dependencies to latest ([7551d04](https://github.com/mlaursen/eslint-config/commit/7551d0457be41ca3844a35b45a1eb11b9a510ffc))
27
+
5
28
  ## [1.4.0](https://github.com/mlaursen/eslint-config/compare/v1.3.0...v1.4.0) (2022-01-11)
6
29
 
7
30
 
package/README.md CHANGED
@@ -5,9 +5,13 @@ A reusable eslint config that I use for most of my projects.
5
5
  ## Usage
6
6
 
7
7
  ```js
8
- module.exports = require("@mlaursen/eslint-config");
8
+ module.exports = {
9
+ extends: "@mlaursen/eslint-config",
10
+ };
9
11
  ```
10
12
 
13
+ ## Additional Type Checking
14
+
11
15
  Or if I want to do additional rules and strict type checking linting rules:
12
16
 
13
17
  ```js
@@ -23,7 +27,9 @@ module.exports = {
23
27
  overrides: [
24
28
  {
25
29
  files: ["**/*.ts", "**/*.tsx"],
26
- extends: ["@typescript-eslint/recommended-requiring-type-checking"],
30
+ extends: [
31
+ "plugin:@typescript-eslint/recommended-requiring-type-checking",
32
+ ],
27
33
  },
28
34
  // any custom overrides for this project
29
35
  ],
package/index.js CHANGED
@@ -54,6 +54,8 @@ module.exports = {
54
54
 
55
55
  // too many false positives with aliases/root dirs
56
56
  'import/no-unresolved': 0,
57
+
58
+ curly: 'error',
57
59
  },
58
60
  overrides: [
59
61
  {
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@mlaursen/eslint-config",
3
- "version": "1.4.0",
3
+ "version": "1.7.0",
4
4
  "description": "An eslint config used by mlaursen for most projects.",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/mlaursen/eslint-config.git",
7
7
  "author": "Mikkel Laursen <mlaursen03@gmail.com>",
8
8
  "license": "MIT",
9
9
  "scripts": {
10
+ "test": "eslint -c index.js \"test/**/*.{js,jsx,ts,tsx}\"",
10
11
  "run-script": "ts-node -T -P tsconfig.node.json",
11
12
  "release": "yarn run-script scripts/release.ts"
12
13
  },
@@ -18,27 +19,28 @@
18
19
  "typescript"
19
20
  ],
20
21
  "dependencies": {
21
- "@typescript-eslint/eslint-plugin": "^5.9.1",
22
- "@typescript-eslint/parser": "^5.9.1",
22
+ "@typescript-eslint/eslint-plugin": "^5.30.0",
23
+ "@typescript-eslint/parser": "^5.30.0",
23
24
  "confusing-browser-globals": "^1.0.11",
24
- "eslint-config-prettier": "^8.2.0",
25
- "eslint-plugin-import": "^2.25.4",
26
- "eslint-plugin-jest": "^25.3.4",
27
- "eslint-plugin-jsx-a11y": "^6.5.1",
28
- "eslint-plugin-react": "^7.28.0",
29
- "eslint-plugin-react-hooks": "^4.3.0",
30
- "eslint-plugin-tsdoc": "^0.2.14"
25
+ "eslint-config-prettier": "^8.5.0",
26
+ "eslint-plugin-import": "^2.26.0",
27
+ "eslint-plugin-jest": "^26.5.3",
28
+ "eslint-plugin-jsx-a11y": "^6.6.0",
29
+ "eslint-plugin-react": "^7.30.1",
30
+ "eslint-plugin-react-hooks": "^4.6.0",
31
+ "eslint-plugin-tsdoc": "^0.2.16"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@mlaursen/changelog-preset": "^1.1.0",
34
35
  "@octokit/core": "^3.5.1",
35
- "@types/inquirer": "^8.1.3",
36
- "@types/node": "^17.0.8",
37
- "dotenv": "^11.0.0",
38
- "inquirer": "^8.2.0",
39
- "standard-version": "^9.3.2",
40
- "ts-node": "^10.4.0",
41
- "typescript": "^4.5.4"
36
+ "@types/inquirer": "^8.2.1",
37
+ "@types/node": "^18.0.0",
38
+ "dotenv": "^16.0.1",
39
+ "eslint": "^8.18.0",
40
+ "inquirer": "^8.2.4",
41
+ "standard-version": "^9.5.0",
42
+ "ts-node": "^10.8.1",
43
+ "typescript": "^4.7.4"
42
44
  },
43
45
  "peerDependencies": {
44
46
  "eslint": ">= 8.0.0",
package/.prettierrc DELETED
@@ -1,9 +0,0 @@
1
- printWidth: 80
2
- trailingComma: es5
3
- overrides:
4
- - files: "*.{js,jsx,scss}"
5
- options:
6
- singleQuote: true
7
- - files: "*.md"
8
- options:
9
- proseWrap: always
package/.versionrc.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('@mlaursen/changelog-preset');
@@ -1,28 +0,0 @@
1
- const packageJson = require('./package.json');
2
- const {
3
- createConfig,
4
- defaultGetCommitType,
5
- } = require('@mlaursen/changelog-preset/createConfig');
6
-
7
- module.exports = createConfig({
8
- tokens: Array.from(
9
- new Set([
10
- ...Object.keys(packageJson.dependencies),
11
- ...Object.keys(packageJson.devDependencies),
12
- ])
13
- ),
14
- ignoreDeps: false,
15
- getCommitType: (commit) => {
16
- const { scope = '' } = commit;
17
- if (scope === 'deps') {
18
- return 'Dependencies';
19
- }
20
-
21
- if (scope === 'dev-deps') {
22
- // don't include dev-deps
23
- return '';
24
- }
25
-
26
- return defaultGetCommitType(commit);
27
- },
28
- });
@@ -1,142 +0,0 @@
1
- import { Octokit } from "@octokit/core";
2
- import { execSync } from "child_process";
3
- import dotenv from "dotenv";
4
- import inquirer from "inquirer";
5
- import { readFileSync } from "node:fs";
6
- import { join } from "node:path";
7
-
8
- function loggedCommand(command: string): void {
9
- console.log(command);
10
- execSync(command, { stdio: "inherit" });
11
- console.log("");
12
- }
13
-
14
- function undo(version?: string): void {
15
- loggedCommand("git reset HEAD^");
16
- if (typeof version === "string") {
17
- loggedCommand(`git tag -d v${version}`);
18
- }
19
- }
20
-
21
- const NEW_ENTRY = /^#{1,3}\s+\[\d/;
22
-
23
- async function getReleaseNotes(version: string): Promise<string> {
24
- console.log("Update the CHANGELOG.md with any additional changes.");
25
- const { confirmed } = await inquirer.prompt<{ confirmed: boolean }>([
26
- {
27
- type: "confirm",
28
- name: "confirmed",
29
- message: "Continue the release?",
30
- },
31
- ]);
32
- if (!confirmed) {
33
- console.error("Canceling the release.");
34
- undo(version);
35
-
36
- process.exit(1);
37
- }
38
-
39
- const changelog = readFileSync(join(process.cwd(), "CHANGELOG.md"), "utf8");
40
- const lines = changelog.split(/\r?\n/);
41
- let lastEntryStart = -1;
42
- let nextEntryStart = -1;
43
-
44
- for (let i = 0; i < lines.length; i += 1) {
45
- if (NEW_ENTRY.test(lines[i])) {
46
- if (lastEntryStart === -1) {
47
- lastEntryStart = i + 1;
48
- } else if (nextEntryStart === -1) {
49
- nextEntryStart = i;
50
- break;
51
- }
52
- }
53
- }
54
-
55
- if (lastEntryStart === -1 || nextEntryStart === -1) {
56
- console.error("Unable to find a release block.");
57
- process.exit(1);
58
- }
59
-
60
- return lines.slice(lastEntryStart, nextEntryStart).join("\n");
61
- }
62
-
63
- const RELEASE_TYPES = ["major", "minor", "patch"];
64
-
65
- async function run(): Promise<void> {
66
- let type = "";
67
- let prerelease = "";
68
- for (let i = 0; i < process.argv.length; i += 1) {
69
- const flag = process.argv[i];
70
- const value = process.argv[i + 1];
71
- if (
72
- flag === "-t" &&
73
- typeof value === "string" &&
74
- RELEASE_TYPES.includes(value)
75
- ) {
76
- type = ` --release-as ${value}`;
77
- } else if (flag === "-p" || flag === "--prerelease") {
78
- prerelease = " --prerelease";
79
- }
80
- }
81
-
82
- const githubDotEnv = join(process.cwd(), ".env.github");
83
- dotenv.config({ path: githubDotEnv });
84
-
85
- const { GITHUB_TOKEN } = process.env;
86
- if (!GITHUB_TOKEN) {
87
- console.error(
88
- `Missing a \`GITHUB_TOKEN\` environment variable. This should be located at:
89
- - ${githubDotEnv}
90
-
91
- A token can be created at:
92
- - https://github.com/settings/tokens/new?scopes=repo
93
- `
94
- );
95
-
96
- process.exit(1);
97
- }
98
-
99
- loggedCommand(`yarn standard-version${type}${prerelease}`);
100
-
101
- const { version } = JSON.parse(
102
- readFileSync(join(process.cwd(), "package.json"), "utf8")
103
- );
104
- if (typeof version !== "string") {
105
- console.error("Unable to get the package version.");
106
- undo();
107
- process.exit(1);
108
- }
109
-
110
- const releaseNotes = await getReleaseNotes(version);
111
- const { confirmed } = await inquirer.prompt<{ confirmed: boolean }>([
112
- {
113
- type: "confirm",
114
- name: "confirmed",
115
- message: `Open the authenticator app to get a one-time password and run the following command:
116
-
117
- npm publish --otp
118
- `,
119
- },
120
- ]);
121
- if (!confirmed) {
122
- console.error("Canceling the release.");
123
- undo(version);
124
-
125
- process.exit(1);
126
- }
127
- loggedCommand("git push --follow-tags origin main");
128
- const octokit = new Octokit({ auth: GITHUB_TOKEN });
129
- const response = await octokit.request(
130
- "POST /repos/{owner}/{repo}/releases",
131
- {
132
- owner: "mlaursen",
133
- repo: "eslint-config",
134
- tag_name: `v${version}`,
135
- body: releaseNotes,
136
- }
137
- );
138
-
139
- console.log(`Created release: ${response.data.html_url}`);
140
- }
141
-
142
- run();
package/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es5",
4
- "module": "commonjs",
5
- "strict": true,
6
- "declaration": true,
7
- "esModuleInterop": true,
8
- "moduleResolution": "node",
9
- "resolveJsonModule": true,
10
- "noFallthroughCasesInSwitch": true,
11
- "allowSyntheticDefaultImports": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "lib": [
14
- "dom",
15
- "dom.iterable",
16
- "esnext"
17
- ]
18
- }
19
- }
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "jsx": "react-jsx",
5
- "target": "es5",
6
- "module": "commonjs",
7
- "skipLibCheck": false,
8
- "isolatedModules": false
9
- }
10
- }