@stanlemon/eslint-config 0.1.160 → 2.0.1

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.
@@ -0,0 +1,144 @@
1
+ import globals from "globals";
2
+ import eslint from "@eslint/js";
3
+ import tseslint from "typescript-eslint";
4
+ import prettierPlugin from "eslint-plugin-prettier/recommended";
5
+ import reactPlugin from "eslint-plugin-react";
6
+ import importPlugin from "eslint-plugin-import";
7
+ import jest from "eslint-plugin-jest";
8
+ import jestDom from "eslint-plugin-jest-dom";
9
+
10
+ export default tseslint.config(
11
+ {
12
+ ignores: [
13
+ "**/node_modules/",
14
+ ".git/",
15
+ "**/dist/",
16
+ // This is an override of @types/pouchdb-core which we want to ignore when linting
17
+ "**/types-pouchdb-core/",
18
+ ],
19
+ },
20
+ eslint.configs.recommended,
21
+ prettierPlugin,
22
+ importPlugin.flatConfigs.react,
23
+ importPlugin.flatConfigs.typescript,
24
+
25
+ reactPlugin.configs.flat.recommended,
26
+ {
27
+ languageOptions: {
28
+ parser: tseslint.parser,
29
+ ecmaVersion: "latest",
30
+ sourceType: "module",
31
+ parserOptions: {
32
+ ecmaFeatures: {
33
+ jsx: true,
34
+ },
35
+ },
36
+ globals: {
37
+ ...globals.browser,
38
+ ...globals.jest,
39
+ ...globals.node,
40
+ },
41
+ },
42
+ plugins: {
43
+ reactPlugin,
44
+ },
45
+ settings: {
46
+ react: {
47
+ version: "detect",
48
+ },
49
+ },
50
+ rules: {
51
+ // Requires strict equality
52
+ eqeqeq: "error",
53
+ // If functions are too long, break them up into smaller ones
54
+ "max-lines-per-function": [
55
+ "error",
56
+ {
57
+ max: 80,
58
+ skipBlankLines: true,
59
+ skipComments: true,
60
+ },
61
+ ],
62
+ // Linting shouldn't break on this, but we also want to discourage using console logging
63
+ "no-console": ["warn", { allow: ["warn", "error"] }],
64
+ // Requires the displayName property to be set, not ideal for stateless components
65
+ "no-unused-vars": [
66
+ "warn",
67
+ {
68
+ caughtErrors: "none",
69
+ destructuredArrayIgnorePattern: "^_",
70
+ ignoreRestSiblings: true,
71
+ args: "none",
72
+ },
73
+ ],
74
+ "no-empty-function": "off",
75
+ "react/display-name": "off",
76
+ "react/react-in-jsx-scope": "off",
77
+ "react/jsx-uses-react": "off",
78
+ "react/prop-types": "off",
79
+ "react/no-unescaped-entities": ["error", { forbid: [">", "}"] }],
80
+ "prettier/prettier": [
81
+ "error",
82
+ {
83
+ trailingComma: "es5",
84
+ },
85
+ ],
86
+ },
87
+ },
88
+ {
89
+ files: ["**/*.ts", "**/*.tsx"],
90
+ extends: [...tseslint.configs.recommended],
91
+ /*
92
+ languageOptions: {
93
+ parserOptions: {
94
+ projectService: {
95
+ allowDefaultProject: ['*.ts', '*.tsx'],
96
+ },
97
+ tsconfigRootDir: import.meta.dirname,
98
+
99
+ },
100
+ },
101
+ */
102
+ rules: {
103
+ "@typescript-eslint/no-unused-vars": [
104
+ "warn",
105
+ {
106
+ caughtErrors: "none",
107
+ destructuredArrayIgnorePattern: "^_",
108
+ ignoreRestSiblings: true,
109
+ args: "none",
110
+ },
111
+ ],
112
+ "@typescript-eslint/no-empty-function": "off",
113
+ // Do not require 'public' before public methods
114
+ "@typescript-eslint/explicit-member-accessibility": "off",
115
+ },
116
+ },
117
+ {
118
+ files: ["**/*.jsx", "**/*.tsx"],
119
+ rules: {
120
+ "max-lines-per-function": [
121
+ "error",
122
+ {
123
+ max: 160, // Twice as long as normal
124
+ skipBlankLines: true,
125
+ skipComments: true,
126
+ },
127
+ ],
128
+ },
129
+ },
130
+ {
131
+ files: [
132
+ "**/*.test.js",
133
+ "**/*.test.ts",
134
+ "**/*.test.tsx",
135
+ "jest.setup.js",
136
+ "jest.config.js",
137
+ ],
138
+ ...jestDom.configs["flat/recommended"],
139
+ ...jest.configs["flat/recommended"],
140
+ rules: {
141
+ "max-lines-per-function": "off",
142
+ },
143
+ }
144
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stanlemon/eslint-config",
3
- "version": "0.1.160",
3
+ "version": "2.0.1",
4
4
  "description": "My typical eslint setup, but without all the copy and paste.",
5
5
  "keywords": [
6
6
  "eslint"
@@ -8,29 +8,30 @@
8
8
  "author": "Stan Lemon <stanlemon@users.noreply.github.com>",
9
9
  "license": "MIT",
10
10
  "engines": {
11
- "node": ">=18.0"
11
+ "node": ">=20.0"
12
12
  },
13
- "type": "commonjs",
13
+ "type": "module",
14
+ "main": "./eslint.config.js",
14
15
  "scripts": {
15
- "lint": "eslint --ext js,jsx,ts,tsx ./",
16
- "lint:fix": "eslint --fix --ext js,jsx,ts,tsx ./"
16
+ "lint": "eslint .",
17
+ "lint:fix": "eslint --fix ."
17
18
  },
18
19
  "dependencies": {
19
- "@babel/eslint-parser": "^7.25.7",
20
- "@typescript-eslint/eslint-plugin": "^8.8.0",
21
- "@typescript-eslint/parser": "^8.8.0",
20
+ "@eslint/js": "^9.12.0",
21
+ "@types/eslint__js": "^8.42.3",
22
22
  "eslint": "^9.12.0",
23
23
  "eslint-config-prettier": "^9.1.0",
24
24
  "eslint-config-react": "^1.1.7",
25
25
  "eslint-config-typescript": "^3.0.0",
26
- "eslint-plugin-deprecation": "^3.0.0",
26
+ "eslint-import-resolver-typescript": "^3.6.3",
27
27
  "eslint-plugin-import": "^2.31.0",
28
28
  "eslint-plugin-jest": "^28.8.3",
29
29
  "eslint-plugin-jest-dom": "^5.4.0",
30
- "eslint-plugin-jsx-a11y": "^6.10.0",
31
30
  "eslint-plugin-prettier": "^5.2.1",
32
31
  "eslint-plugin-react": "^7.37.1",
33
- "eslint-plugin-react-hooks": "^4.6.2",
34
- "prettier": "^3.3.3"
32
+ "globals": "^15.11.0",
33
+ "prettier": "^3.3.3",
34
+ "typescript": "^5.6.3",
35
+ "typescript-eslint": "^8.8.1"
35
36
  }
36
37
  }
package/.eslintrc.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
package/index.js DELETED
@@ -1,127 +0,0 @@
1
- const fs = require("fs");
2
-
3
- // A package can define a custom tsconfig just for eslint, and if they do we should use it
4
- const tsconfigPath = fs.existsSync("./tsconfig.eslint.json")
5
- ? "./tsconfig.eslint.json"
6
- : "./tsconfig.json";
7
- // Does the desired tsconfig exist?
8
- const tsconfigExists = fs.existsSync(tsconfigPath);
9
-
10
- module.exports = {
11
- env: {
12
- es2022: true,
13
- browser: true,
14
- node: true,
15
- jest: true,
16
- },
17
- ...(tsconfigExists && { parser: "@typescript-eslint/parser" }),
18
- parserOptions: {
19
- sourceType: "module",
20
- ...(tsconfigExists && { project: tsconfigPath }),
21
- },
22
- extends: [
23
- "eslint:recommended",
24
- "plugin:jest/recommended",
25
- "plugin:jest-dom/recommended",
26
- "plugin:prettier/recommended",
27
- "plugin:react/recommended",
28
- "plugin:react/jsx-runtime",
29
- "typescript",
30
- "typescript/react",
31
- ],
32
- plugins: ["import", ...(tsconfigExists ? ["deprecation"] : [])],
33
- settings: {
34
- react: {
35
- version: "detect",
36
- },
37
- },
38
- rules: {
39
- // Requires strict equality
40
- eqeqeq: "error",
41
- // If functions are too long, break them up into smaller ones
42
- "max-lines-per-function": [
43
- "error",
44
- {
45
- max: 80,
46
- skipBlankLines: true,
47
- skipComments: true,
48
- },
49
- ],
50
- // Linting shouldn't break on this, but we also want to discourage using console logging
51
- "no-console": ["warn", { allow: ["warn", "error"] }],
52
- // Requires the displayName property to be set, not ideal for stateless components
53
- "react/display-name": "off",
54
- "react/react-in-jsx-scope": "off",
55
- "react/jsx-uses-react": "off",
56
- "react/prop-types": "off",
57
- "react/no-unescaped-entities": ["error", { forbid: [">", "}"] }],
58
- // Allow exporting of unnamed objects as a default
59
- "import/no-anonymous-default-export": [
60
- "error",
61
- {
62
- allowObject: true,
63
- },
64
- ],
65
- "import/first": "error",
66
- "import/no-amd": "error",
67
- "import/no-webpack-loader-syntax": "error",
68
- "import/no-unused-modules": "error",
69
- "prettier/prettier": [
70
- "error",
71
- {
72
- trailingComma: "es5",
73
- },
74
- ],
75
- "no-unused-vars": [
76
- "warn",
77
- {
78
- caughtErrors: "none",
79
- destructuredArrayIgnorePattern: "^_",
80
- ignoreRestSiblings: true,
81
- args: "none",
82
- },
83
- ],
84
- "@typescript-eslint/no-unused-vars": [
85
- "warn",
86
- {
87
- caughtErrors: "none",
88
- destructuredArrayIgnorePattern: "^_",
89
- ignoreRestSiblings: true,
90
- args: "none",
91
- },
92
- ],
93
- ...(tsconfigExists && { "deprecation/deprecation": "warn" }),
94
- },
95
- overrides: [
96
- {
97
- files: ["**/*.{ts,tsx}"],
98
- rules: {
99
- // Empty functions are ok, especially for default values
100
- "no-empty-function": "off",
101
- "@typescript-eslint/no-empty-function": "off",
102
- // Requires 'public' before public methods
103
- "@typescript-eslint/explicit-member-accessibility": "off",
104
- },
105
- },
106
- {
107
- files: ["**/*.jsx", "**/*.tsx"],
108
- rules: {
109
- "max-lines-per-function": [
110
- "error",
111
- {
112
- max: 160, // Twice as long as normal
113
- skipBlankLines: true,
114
- skipComments: true,
115
- },
116
- ],
117
- },
118
- },
119
- {
120
- files: ["**/*.test.js", "**/*.test.ts", "**/*.test.tsx"],
121
- rules: {
122
- "max-lines-per-function": "off",
123
- },
124
- },
125
- ],
126
- ignorePatterns: [".eslintrc.js", "dist/", "node_modules/"],
127
- };