@will-stone/eslint-config 0.5.0 → 0.6.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/README.md +2 -0
- package/dist/index.cjs +25 -11
- package/dist/index.js +25 -11
- package/package.json +13 -3
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -749,6 +749,7 @@ var GLOB_EXCLUDE = [
|
|
|
749
749
|
"**/temp",
|
|
750
750
|
"**/.vitepress/cache",
|
|
751
751
|
"**/.nuxt",
|
|
752
|
+
"**/.next",
|
|
752
753
|
"**/.vercel",
|
|
753
754
|
"**/.changeset",
|
|
754
755
|
"**/.idea",
|
|
@@ -970,9 +971,13 @@ function jest() {
|
|
|
970
971
|
|
|
971
972
|
// src/configs/node.ts
|
|
972
973
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
974
|
+
var import_globals3 = __toESM(require("globals"), 1);
|
|
973
975
|
function node() {
|
|
974
976
|
return [
|
|
975
977
|
{
|
|
978
|
+
languageOptions: {
|
|
979
|
+
globals: import_globals3.default.node
|
|
980
|
+
},
|
|
976
981
|
plugins: {
|
|
977
982
|
n: import_eslint_plugin_n.default
|
|
978
983
|
},
|
|
@@ -1056,13 +1061,13 @@ function prettier() {
|
|
|
1056
1061
|
var import_eslint_plugin_jsx_a11y = __toESM(require("eslint-plugin-jsx-a11y"), 1);
|
|
1057
1062
|
var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
|
|
1058
1063
|
var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
|
|
1059
|
-
var
|
|
1064
|
+
var import_globals4 = __toESM(require("globals"), 1);
|
|
1060
1065
|
function react() {
|
|
1061
1066
|
return [
|
|
1062
1067
|
{
|
|
1063
1068
|
files: ["**/*.{jsx,tsx}"],
|
|
1064
1069
|
languageOptions: {
|
|
1065
|
-
globals:
|
|
1070
|
+
globals: import_globals4.default.browser,
|
|
1066
1071
|
parserOptions: {
|
|
1067
1072
|
ecmaFeatures: {
|
|
1068
1073
|
jsx: true
|
|
@@ -2037,18 +2042,22 @@ function checkEnvironment() {
|
|
|
2037
2042
|
const packageJson = (0, import_load_json_file.loadJsonFileSync)(packageJsonPath);
|
|
2038
2043
|
if (!testingFramework && Boolean(
|
|
2039
2044
|
packageJson.dependencies?.jest || packageJson.devDependencies?.jest
|
|
2040
|
-
))
|
|
2045
|
+
)) {
|
|
2041
2046
|
testingFramework = "jest";
|
|
2042
|
-
|
|
2047
|
+
}
|
|
2048
|
+
if (!isNodeEngine && Boolean(packageJson.engines?.node)) {
|
|
2043
2049
|
isNodeEngine = true;
|
|
2050
|
+
}
|
|
2044
2051
|
if (!isPrettier && Boolean(
|
|
2045
2052
|
packageJson.dependencies?.prettier || packageJson.devDependencies?.prettier
|
|
2046
|
-
))
|
|
2053
|
+
)) {
|
|
2047
2054
|
isPrettier = true;
|
|
2055
|
+
}
|
|
2048
2056
|
if (!isTailwind && Boolean(
|
|
2049
2057
|
packageJson.dependencies?.tailwindcss || packageJson.devDependencies?.tailwindcss
|
|
2050
|
-
))
|
|
2058
|
+
)) {
|
|
2051
2059
|
isTailwind = true;
|
|
2060
|
+
}
|
|
2052
2061
|
}
|
|
2053
2062
|
const isNode = isNodeEngine || (0, import_node_fs.existsSync)(".nvmrc") || (0, import_node_fs.existsSync)(".node-version");
|
|
2054
2063
|
return {
|
|
@@ -2064,8 +2073,9 @@ function checkEnvironment() {
|
|
|
2064
2073
|
function factory() {
|
|
2065
2074
|
const { isGitIgnore, isNode, isPrettier, isTailwind, testingFramework } = checkEnvironment();
|
|
2066
2075
|
const configs = [];
|
|
2067
|
-
if (isGitIgnore)
|
|
2076
|
+
if (isGitIgnore) {
|
|
2068
2077
|
configs.push([(0, import_eslint_config_flat_gitignore.default)()]);
|
|
2078
|
+
}
|
|
2069
2079
|
configs.push(
|
|
2070
2080
|
ignores(),
|
|
2071
2081
|
base(),
|
|
@@ -2076,14 +2086,18 @@ function factory() {
|
|
|
2076
2086
|
astro(),
|
|
2077
2087
|
react()
|
|
2078
2088
|
);
|
|
2079
|
-
if (isNode)
|
|
2089
|
+
if (isNode) {
|
|
2080
2090
|
configs.push(node());
|
|
2081
|
-
|
|
2091
|
+
}
|
|
2092
|
+
if (isTailwind) {
|
|
2082
2093
|
configs.push(node());
|
|
2083
|
-
|
|
2094
|
+
}
|
|
2095
|
+
if (testingFramework === "jest") {
|
|
2084
2096
|
configs.push(jest());
|
|
2085
|
-
|
|
2097
|
+
}
|
|
2098
|
+
if (isPrettier) {
|
|
2086
2099
|
configs.push(prettier());
|
|
2100
|
+
}
|
|
2087
2101
|
const merged = configs.flat();
|
|
2088
2102
|
return merged;
|
|
2089
2103
|
}
|
package/dist/index.js
CHANGED
|
@@ -713,6 +713,7 @@ var GLOB_EXCLUDE = [
|
|
|
713
713
|
"**/temp",
|
|
714
714
|
"**/.vitepress/cache",
|
|
715
715
|
"**/.nuxt",
|
|
716
|
+
"**/.next",
|
|
716
717
|
"**/.vercel",
|
|
717
718
|
"**/.changeset",
|
|
718
719
|
"**/.idea",
|
|
@@ -934,9 +935,13 @@ function jest() {
|
|
|
934
935
|
|
|
935
936
|
// src/configs/node.ts
|
|
936
937
|
import pluginNode from "eslint-plugin-n";
|
|
938
|
+
import globals3 from "globals";
|
|
937
939
|
function node() {
|
|
938
940
|
return [
|
|
939
941
|
{
|
|
942
|
+
languageOptions: {
|
|
943
|
+
globals: globals3.node
|
|
944
|
+
},
|
|
940
945
|
plugins: {
|
|
941
946
|
n: pluginNode
|
|
942
947
|
},
|
|
@@ -1020,13 +1025,13 @@ function prettier() {
|
|
|
1020
1025
|
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
|
|
1021
1026
|
import pluginReact from "eslint-plugin-react";
|
|
1022
1027
|
import pluginReactHooks from "eslint-plugin-react-hooks";
|
|
1023
|
-
import
|
|
1028
|
+
import globals4 from "globals";
|
|
1024
1029
|
function react() {
|
|
1025
1030
|
return [
|
|
1026
1031
|
{
|
|
1027
1032
|
files: ["**/*.{jsx,tsx}"],
|
|
1028
1033
|
languageOptions: {
|
|
1029
|
-
globals:
|
|
1034
|
+
globals: globals4.browser,
|
|
1030
1035
|
parserOptions: {
|
|
1031
1036
|
ecmaFeatures: {
|
|
1032
1037
|
jsx: true
|
|
@@ -2001,18 +2006,22 @@ function checkEnvironment() {
|
|
|
2001
2006
|
const packageJson = loadJsonFileSync(packageJsonPath);
|
|
2002
2007
|
if (!testingFramework && Boolean(
|
|
2003
2008
|
packageJson.dependencies?.jest || packageJson.devDependencies?.jest
|
|
2004
|
-
))
|
|
2009
|
+
)) {
|
|
2005
2010
|
testingFramework = "jest";
|
|
2006
|
-
|
|
2011
|
+
}
|
|
2012
|
+
if (!isNodeEngine && Boolean(packageJson.engines?.node)) {
|
|
2007
2013
|
isNodeEngine = true;
|
|
2014
|
+
}
|
|
2008
2015
|
if (!isPrettier && Boolean(
|
|
2009
2016
|
packageJson.dependencies?.prettier || packageJson.devDependencies?.prettier
|
|
2010
|
-
))
|
|
2017
|
+
)) {
|
|
2011
2018
|
isPrettier = true;
|
|
2019
|
+
}
|
|
2012
2020
|
if (!isTailwind && Boolean(
|
|
2013
2021
|
packageJson.dependencies?.tailwindcss || packageJson.devDependencies?.tailwindcss
|
|
2014
|
-
))
|
|
2022
|
+
)) {
|
|
2015
2023
|
isTailwind = true;
|
|
2024
|
+
}
|
|
2016
2025
|
}
|
|
2017
2026
|
const isNode = isNodeEngine || existsSync(".nvmrc") || existsSync(".node-version");
|
|
2018
2027
|
return {
|
|
@@ -2028,8 +2037,9 @@ function checkEnvironment() {
|
|
|
2028
2037
|
function factory() {
|
|
2029
2038
|
const { isGitIgnore, isNode, isPrettier, isTailwind, testingFramework } = checkEnvironment();
|
|
2030
2039
|
const configs = [];
|
|
2031
|
-
if (isGitIgnore)
|
|
2040
|
+
if (isGitIgnore) {
|
|
2032
2041
|
configs.push([gitignore()]);
|
|
2042
|
+
}
|
|
2033
2043
|
configs.push(
|
|
2034
2044
|
ignores(),
|
|
2035
2045
|
base(),
|
|
@@ -2040,14 +2050,18 @@ function factory() {
|
|
|
2040
2050
|
astro(),
|
|
2041
2051
|
react()
|
|
2042
2052
|
);
|
|
2043
|
-
if (isNode)
|
|
2053
|
+
if (isNode) {
|
|
2044
2054
|
configs.push(node());
|
|
2045
|
-
|
|
2055
|
+
}
|
|
2056
|
+
if (isTailwind) {
|
|
2046
2057
|
configs.push(node());
|
|
2047
|
-
|
|
2058
|
+
}
|
|
2059
|
+
if (testingFramework === "jest") {
|
|
2048
2060
|
configs.push(jest());
|
|
2049
|
-
|
|
2061
|
+
}
|
|
2062
|
+
if (isPrettier) {
|
|
2050
2063
|
configs.push(prettier());
|
|
2064
|
+
}
|
|
2051
2065
|
const merged = configs.flat();
|
|
2052
2066
|
return merged;
|
|
2053
2067
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@will-stone/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Will Stone's ESLint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config"
|
|
@@ -28,10 +28,19 @@
|
|
|
28
28
|
"build": "tsup src/index.ts --format esm,cjs --clean --dts",
|
|
29
29
|
"dev": "tsup src/index.ts --format esm,cjs --watch & eslint-flat-config-viewer",
|
|
30
30
|
"lint": "npm run stub && eslint .",
|
|
31
|
+
"prepare": "husky install",
|
|
31
32
|
"prepublishOnly": "npm run build",
|
|
32
33
|
"stub": "tsup src/index.ts --format esm",
|
|
33
34
|
"typecheck": "tsc --noEmit"
|
|
34
35
|
},
|
|
36
|
+
"lint-staged": {
|
|
37
|
+
"*.{js,jsx,ts,tsx}": [
|
|
38
|
+
"eslint --fix"
|
|
39
|
+
],
|
|
40
|
+
"*.{css,json,md}": [
|
|
41
|
+
"prettier --write"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
35
44
|
"prettier": "@will-stone/prettier-config",
|
|
36
45
|
"dependencies": {
|
|
37
46
|
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
@@ -64,11 +73,12 @@
|
|
|
64
73
|
"@will-stone/prettier-config": "^7.0.1",
|
|
65
74
|
"eslint": "^8.50.0",
|
|
66
75
|
"eslint-flat-config-viewer": "^0.0.8",
|
|
76
|
+
"husky": "^8.0.3",
|
|
67
77
|
"lint-staged": "^14.0.1",
|
|
68
78
|
"prettier": "^3.0.3",
|
|
69
79
|
"tsup": "^7.2.0",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
80
|
+
"type-fest": "^4.3.3",
|
|
81
|
+
"typescript": "^5.2.2"
|
|
72
82
|
},
|
|
73
83
|
"peerDependencies": {
|
|
74
84
|
"eslint": ">=8.0.0"
|