@workleap/eslint-configs 0.0.2
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 +13 -0
- package/LICENSE +201 -0
- package/README.md +16 -0
- package/dist/by-project-type/defineMonorepoWorkspaceConfig.d.ts +15 -0
- package/dist/by-project-type/defineMonorepoWorkspaceConfig.js +51 -0
- package/dist/by-project-type/defineMonorepoWorkspaceConfig.js.map +1 -0
- package/dist/by-project-type/defineReactLibraryConfig.d.ts +27 -0
- package/dist/by-project-type/defineReactLibraryConfig.js +96 -0
- package/dist/by-project-type/defineReactLibraryConfig.js.map +1 -0
- package/dist/by-project-type/defineTypescriptLibraryConfig.d.ts +19 -0
- package/dist/by-project-type/defineTypescriptLibraryConfig.js +72 -0
- package/dist/by-project-type/defineTypescriptLibraryConfig.js.map +1 -0
- package/dist/by-project-type/defineWebApplicationConfig.d.ts +27 -0
- package/dist/by-project-type/defineWebApplicationConfig.js +96 -0
- package/dist/by-project-type/defineWebApplicationConfig.js.map +1 -0
- package/dist/core.d.ts +7 -0
- package/dist/core.js +184 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/jest.d.ts +7 -0
- package/dist/jest.js +55 -0
- package/dist/jest.js.map +1 -0
- package/dist/jsxAlly.d.ts +7 -0
- package/dist/jsxAlly.js +51 -0
- package/dist/jsxAlly.js.map +1 -0
- package/dist/packageJson.d.ts +7 -0
- package/dist/packageJson.js +47 -0
- package/dist/packageJson.js.map +1 -0
- package/dist/plugins/strictCssModulesNames.d.ts +7 -0
- package/dist/plugins/strictCssModulesNames.js +70 -0
- package/dist/plugins/strictCssModulesNames.js.map +1 -0
- package/dist/plugins/workleapPlugin.d.ts +5 -0
- package/dist/plugins/workleapPlugin.js +15 -0
- package/dist/plugins/workleapPlugin.js.map +1 -0
- package/dist/react.d.ts +7 -0
- package/dist/react.js +189 -0
- package/dist/react.js.map +1 -0
- package/dist/storybook.d.ts +8 -0
- package/dist/storybook.js +46 -0
- package/dist/storybook.js.map +1 -0
- package/dist/testingLibrary.d.ts +8 -0
- package/dist/testingLibrary.js +43 -0
- package/dist/testingLibrary.js.map +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/typescript.d.ts +7 -0
- package/dist/typescript.js +139 -0
- package/dist/typescript.js.map +1 -0
- package/dist/vitest.d.ts +7 -0
- package/dist/vitest.js +40 -0
- package/dist/vitest.js.map +1 -0
- package/dist/yaml.d.ts +7 -0
- package/dist/yaml.js +31 -0
- package/dist/yaml.js.map +1 -0
- package/package.json +82 -0
- package/src/by-project-type/defineMonorepoWorkspaceConfig.ts +45 -0
- package/src/by-project-type/defineReactLibraryConfig.ts +81 -0
- package/src/by-project-type/defineTypescriptLibraryConfig.ts +61 -0
- package/src/by-project-type/defineWebApplicationConfig.ts +114 -0
- package/src/core.ts +138 -0
- package/src/index.ts +16 -0
- package/src/jest.ts +53 -0
- package/src/jsxAlly.ts +52 -0
- package/src/packageJson.ts +48 -0
- package/src/plugins/strictCssModulesNames.ts +75 -0
- package/src/plugins/workleapPlugin.ts +7 -0
- package/src/react.ts +175 -0
- package/src/storybook.ts +53 -0
- package/src/testingLibrary.ts +48 -0
- package/src/types.ts +27 -0
- package/src/typescript.ts +133 -0
- package/src/vitest.ts +41 -0
- package/src/yaml.ts +32 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
|
+
import { coreConfig, coreGlobalIgnores } from "../core.js";
|
|
3
|
+
import { jestConfig, jestGlobalIgnores } from "../jest.js";
|
|
4
|
+
import { jsxAllyConfig, jsxAllyGlobalIgnores } from "../jsxAlly.js";
|
|
5
|
+
import { packageJsonConfig, packageJsonGlobalIgnores } from "../packageJson.js";
|
|
6
|
+
import { WorkleapPlugin } from "../plugins/workleapPlugin.js";
|
|
7
|
+
import { reactConfig, reactGlobalIgnores } from "../react.js";
|
|
8
|
+
import { storybookConfig, storybookGlobalIgnores } from "../storybook.js";
|
|
9
|
+
import { testingLibraryConfig, testingLibraryGlobalIgnores } from "../testingLibrary.js";
|
|
10
|
+
import { typescriptConfig, typescriptGlobalIgnores } from "../typescript.js";
|
|
11
|
+
import { vitestConfig, vitestGlobalIgnores } from "../vitest.js";
|
|
12
|
+
import { yamlConfig, yamlGlobalIgnores } from "../yaml.js";
|
|
13
|
+
|
|
14
|
+
;// CONCATENATED MODULE: external "eslint/config"
|
|
15
|
+
|
|
16
|
+
;// CONCATENATED MODULE: external "../core.js"
|
|
17
|
+
|
|
18
|
+
;// CONCATENATED MODULE: external "../jest.js"
|
|
19
|
+
|
|
20
|
+
;// CONCATENATED MODULE: external "../jsxAlly.js"
|
|
21
|
+
|
|
22
|
+
;// CONCATENATED MODULE: external "../packageJson.js"
|
|
23
|
+
|
|
24
|
+
;// CONCATENATED MODULE: external "../plugins/workleapPlugin.js"
|
|
25
|
+
|
|
26
|
+
;// CONCATENATED MODULE: external "../react.js"
|
|
27
|
+
|
|
28
|
+
;// CONCATENATED MODULE: external "../storybook.js"
|
|
29
|
+
|
|
30
|
+
;// CONCATENATED MODULE: external "../testingLibrary.js"
|
|
31
|
+
|
|
32
|
+
;// CONCATENATED MODULE: external "../typescript.js"
|
|
33
|
+
|
|
34
|
+
;// CONCATENATED MODULE: external "../vitest.js"
|
|
35
|
+
|
|
36
|
+
;// CONCATENATED MODULE: external "../yaml.js"
|
|
37
|
+
|
|
38
|
+
;// CONCATENATED MODULE: ./src/by-project-type/defineWebApplicationConfig.ts
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param tsconfigRootDir The directory of the tsconfig file to use for rules that needs a TypeScript type check: https://typescript-eslint.io/packages/parser/#tsconfigrootdir.
|
|
53
|
+
* @param options An optional object of options for the ESlint core and plugins rules.
|
|
54
|
+
*/ const defineWebApplicationConfig = (tsconfigRootDir, options = {})=>{
|
|
55
|
+
const { core, jest, jsxAlly, packageJson, react, storybook, testingLibrary, typescript, vitest, yaml } = options;
|
|
56
|
+
return defineConfig([
|
|
57
|
+
// node_modules folder is ignored by default.
|
|
58
|
+
globalIgnores([
|
|
59
|
+
"dist",
|
|
60
|
+
...coreGlobalIgnores,
|
|
61
|
+
...jestGlobalIgnores,
|
|
62
|
+
...jsxAllyGlobalIgnores,
|
|
63
|
+
...packageJsonGlobalIgnores,
|
|
64
|
+
...reactGlobalIgnores,
|
|
65
|
+
...storybookGlobalIgnores,
|
|
66
|
+
...testingLibraryGlobalIgnores,
|
|
67
|
+
...typescriptGlobalIgnores,
|
|
68
|
+
...vitestGlobalIgnores,
|
|
69
|
+
...yamlGlobalIgnores
|
|
70
|
+
]),
|
|
71
|
+
...coreConfig(core),
|
|
72
|
+
...jestConfig(jest),
|
|
73
|
+
...jsxAllyConfig(jsxAlly),
|
|
74
|
+
...packageJsonConfig(packageJson),
|
|
75
|
+
...reactConfig(react),
|
|
76
|
+
...storybookConfig(storybook),
|
|
77
|
+
...testingLibraryConfig(testingLibrary),
|
|
78
|
+
...typescriptConfig(tsconfigRootDir, typescript),
|
|
79
|
+
// Temporary fix until the vitest plugin support defineConfig and the types are fixed.
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
...vitestConfig(vitest),
|
|
82
|
+
...yamlConfig(yaml),
|
|
83
|
+
{
|
|
84
|
+
plugins: {
|
|
85
|
+
"@workleap": WorkleapPlugin
|
|
86
|
+
},
|
|
87
|
+
rules: {
|
|
88
|
+
"@workleap/strict-css-modules-names": "warn"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
]);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export { defineWebApplicationConfig };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=defineWebApplicationConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"by-project-type/defineWebApplicationConfig.js","sources":["webpack://@workleap/eslint-configs/./src/by-project-type/defineWebApplicationConfig.ts"],"sourcesContent":["import { defineConfig, globalIgnores } from \"eslint/config\";\nimport { coreConfig, type CoreConfigOptions, coreGlobalIgnores } from \"../core.ts\";\nimport { jestConfig, type JestConfigOptions, jestGlobalIgnores } from \"../jest.ts\";\nimport { jsxAllyConfig, type JsxAllyConfigOptions, jsxAllyGlobalIgnores } from \"../jsxAlly.ts\";\nimport { packageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from \"../packageJson.ts\";\nimport { WorkleapPlugin } from \"../plugins/workleapPlugin.ts\";\nimport { reactConfig, type ReactConfigOptions, reactGlobalIgnores } from \"../react.ts\";\nimport { storybookConfig, type StorybookConfigOptions, storybookGlobalIgnores } from \"../storybook.ts\";\nimport { testingLibraryConfig, type TestingLibraryConfigOptions, testingLibraryGlobalIgnores } from \"../testingLibrary.ts\";\nimport { typescriptConfig, type TypescriptConfigOptions, typescriptGlobalIgnores } from \"../typescript.ts\";\nimport { vitestConfig, type VitestConfigOptions, vitestGlobalIgnores } from \"../vitest.ts\";\nimport { yamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from \"../yaml.ts\";\n\n/*\n\nThe WHY for the interface instead of using nested \"extends\".\n\n1- ESlint flat config doesn't support nested \"extends\":\n\nEach configuration object may have an extends key, but only at the top level — not inside another config that already came from an extends.\n\nFlat config was designed to be explicitly ordered and fully expanded:\n\n- \"extends\" in flat config is syntactic sugar for concatenating multiple config objects.\n- Allowing recursion would make config evaluation order ambiguous and slow.\n\nSo ESLint enforces a one-level-deep rule:\n\n- only a top-level config object can have extends.\n\n2- Each object in the array is evaluated independently. \"plugins\" declared in one object are not inherited by the next object.\nSo when a second object sets the rule using a plugin \"xyz\", it doesn’t \"see\" the plugin \"xyz\" that’s defined inside a predefine config, and ESLint throws.\n\n3- Trying to redefine a plugin that as already been define in a configuration object will throw: Cannot redefine plugin \"xyz\".\n\n*/\n\n/*\n\nerror Parsing error: C:\\Dev\\workleap\\wl-web-configs\\samples\\storybook\\rsbuild\\.storybook\\main.ts was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject\n\n-> It usually means that the project tsconfig.json file cannot find the specified file\n-> Make sure to clear the ESLint cache after such an error because update the tsconfig.json file doesn't invalidate the ESLint cache\n\n*/\n\nexport interface DefineWebApplicationConfigOptions {\n core?: CoreConfigOptions;\n typescript?: TypescriptConfigOptions;\n react?: ReactConfigOptions;\n jsxAlly?: JsxAllyConfigOptions;\n jest?: JestConfigOptions;\n vitest?: VitestConfigOptions;\n testingLibrary?: TestingLibraryConfigOptions;\n storybook?: StorybookConfigOptions;\n packageJson?: PackageJsonConfigOptions;\n yaml?: YamlConfigOptions;\n}\n\n/**\n * @param tsconfigRootDir The directory of the tsconfig file to use for rules that needs a TypeScript type check: https://typescript-eslint.io/packages/parser/#tsconfigrootdir.\n * @param options An optional object of options for the ESlint core and plugins rules.\n */\nexport const defineWebApplicationConfig = (tsconfigRootDir: string, options: DefineWebApplicationConfigOptions = {}) => {\n const {\n core,\n jest,\n jsxAlly,\n packageJson,\n react,\n storybook,\n testingLibrary,\n typescript,\n vitest,\n yaml\n } = options;\n\n return defineConfig([\n // node_modules folder is ignored by default.\n globalIgnores([\n \"dist\",\n ...coreGlobalIgnores,\n ...jestGlobalIgnores,\n ...jsxAllyGlobalIgnores,\n ...packageJsonGlobalIgnores,\n ...reactGlobalIgnores,\n ...storybookGlobalIgnores,\n ...testingLibraryGlobalIgnores,\n ...typescriptGlobalIgnores,\n ...vitestGlobalIgnores,\n ...yamlGlobalIgnores\n ]),\n ...coreConfig(core),\n ...jestConfig(jest),\n ...jsxAllyConfig(jsxAlly),\n ...packageJsonConfig(packageJson),\n ...reactConfig(react),\n ...storybookConfig(storybook),\n ...testingLibraryConfig(testingLibrary),\n ...typescriptConfig(tsconfigRootDir, typescript),\n // Temporary fix until the vitest plugin support defineConfig and the types are fixed.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...(vitestConfig(vitest) as any),\n ...yamlConfig(yaml),\n {\n plugins: {\n \"@workleap\": WorkleapPlugin\n },\n rules: {\n \"@workleap/strict-css-modules-names\": \"warn\"\n }\n }\n ]);\n};\n"],"names":["defineConfig","globalIgnores","coreConfig","coreGlobalIgnores","jestConfig","jestGlobalIgnores","jsxAllyConfig","jsxAllyGlobalIgnores","packageJsonConfig","packageJsonGlobalIgnores","WorkleapPlugin","reactConfig","reactGlobalIgnores","storybookConfig","storybookGlobalIgnores","testingLibraryConfig","testingLibraryGlobalIgnores","typescriptConfig","typescriptGlobalIgnores","vitestConfig","vitestGlobalIgnores","yamlConfig","yamlGlobalIgnores","defineWebApplicationConfig","tsconfigRootDir","options","core","jest","jsxAlly","packageJson","react","storybook","testingLibrary","typescript","vitest","yaml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA4D;AACuB;AACA;AACY;AACgB;AACjD;AACyB;AACgB;AACoB;AAChB;AAChB;AACR;AAgDnF;;;CAGC,GACM,MAAMuB,6BAA6B,CAACC,iBAAyBC,UAA6C,CAAC,CAAC;IAC/G,MAAM,EACFC,IAAI,EACJC,IAAI,EACJC,OAAO,EACPC,WAAW,EACXC,KAAK,EACLC,SAAS,EACTC,cAAc,EACdC,UAAU,EACVC,MAAM,EACNC,IAAI,EACP,GAAGV;IAEJ,OAAOzB,YAAYA,CAAC;QAChB,6CAA6C;QAC7CC,aAAaA,CAAC;YACV;eACGE,iBAAiBA;eACjBE,iBAAiBA;eACjBE,oBAAoBA;eACpBE,wBAAwBA;eACxBG,kBAAkBA;eAClBE,sBAAsBA;eACtBE,2BAA2BA;eAC3BE,uBAAuBA;eACvBE,mBAAmBA;eACnBE,iBAAiBA;SACvB;WACEpB,UAAUA,CAACwB;WACXtB,UAAUA,CAACuB;WACXrB,aAAaA,CAACsB;WACdpB,iBAAiBA,CAACqB;WAClBlB,WAAWA,CAACmB;WACZjB,eAAeA,CAACkB;WAChBhB,oBAAoBA,CAACiB;WACrBf,gBAAgBA,CAACO,iBAAiBS;QACrC,sFAAsF;QACtF,8DAA8D;WAC1Dd,YAAYA,CAACe;WACdb,UAAUA,CAACc;QACd;YACI,SAAS;gBACL,aAAazB,cAAcA;YAC/B;YACA,OAAO;gBACH,sCAAsC;YAC1C;QACJ;KACH;AACL,EAAE"}
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Linter } from "eslint";
|
|
2
|
+
import type { ConfigWithExtends } from "./types.ts";
|
|
3
|
+
export interface CoreConfigOptions {
|
|
4
|
+
rules?: Partial<Linter.RulesRecord>;
|
|
5
|
+
}
|
|
6
|
+
export declare const coreGlobalIgnores: never[];
|
|
7
|
+
export declare function coreConfig(options?: CoreConfigOptions): ConfigWithExtends[];
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import eslint_plugin_import from "eslint-plugin-import";
|
|
3
|
+
import globals from "globals";
|
|
4
|
+
|
|
5
|
+
;// CONCATENATED MODULE: external "@eslint/js"
|
|
6
|
+
|
|
7
|
+
;// CONCATENATED MODULE: external "eslint-plugin-import"
|
|
8
|
+
|
|
9
|
+
;// CONCATENATED MODULE: external "globals"
|
|
10
|
+
|
|
11
|
+
;// CONCATENATED MODULE: ./src/core.ts
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const coreGlobalIgnores = [];
|
|
16
|
+
function coreConfig(options = {}) {
|
|
17
|
+
const { rules } = options;
|
|
18
|
+
const config = [
|
|
19
|
+
{
|
|
20
|
+
name: "@workleap/eslint-configs/core",
|
|
21
|
+
files: [
|
|
22
|
+
"**/*.{js,jsx,ts,tsx,cjs,mjs}"
|
|
23
|
+
],
|
|
24
|
+
plugins: {
|
|
25
|
+
js: js,
|
|
26
|
+
import: eslint_plugin_import
|
|
27
|
+
},
|
|
28
|
+
extends: [
|
|
29
|
+
js.configs.recommended
|
|
30
|
+
],
|
|
31
|
+
languageOptions: {
|
|
32
|
+
ecmaVersion: "latest",
|
|
33
|
+
sourceType: "module",
|
|
34
|
+
globals: {
|
|
35
|
+
...globals.browser,
|
|
36
|
+
...globals.es2024,
|
|
37
|
+
...globals.node,
|
|
38
|
+
...globals.commonjs
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
rules: {
|
|
42
|
+
// Recommended rules overrides
|
|
43
|
+
"no-cond-assign": [
|
|
44
|
+
"error",
|
|
45
|
+
"except-parens"
|
|
46
|
+
],
|
|
47
|
+
"no-labels": [
|
|
48
|
+
"warn",
|
|
49
|
+
{
|
|
50
|
+
allowLoop: true,
|
|
51
|
+
allowSwitch: false
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"no-prototype-builtins": "off",
|
|
55
|
+
// Possible problems
|
|
56
|
+
"array-callback-return": "error",
|
|
57
|
+
"no-self-compare": "error",
|
|
58
|
+
"no-template-curly-in-string": "error",
|
|
59
|
+
"no-use-before-define": [
|
|
60
|
+
"error",
|
|
61
|
+
{
|
|
62
|
+
functions: false,
|
|
63
|
+
classes: false,
|
|
64
|
+
variables: false
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
// Suggestions
|
|
68
|
+
curly: "warn",
|
|
69
|
+
eqeqeq: [
|
|
70
|
+
"warn",
|
|
71
|
+
"smart"
|
|
72
|
+
],
|
|
73
|
+
"no-array-constructor": "warn",
|
|
74
|
+
"no-caller": "warn",
|
|
75
|
+
"no-eval": "warn",
|
|
76
|
+
"no-extend-native": "warn",
|
|
77
|
+
"no-extra-bind": "warn",
|
|
78
|
+
"no-extra-label": "warn",
|
|
79
|
+
"no-implied-eval": "warn",
|
|
80
|
+
"no-iterator": "warn",
|
|
81
|
+
"no-label-var": "warn",
|
|
82
|
+
"no-lone-blocks": "warn",
|
|
83
|
+
"no-loop-func": "warn",
|
|
84
|
+
"no-mixed-operators": [
|
|
85
|
+
"warn",
|
|
86
|
+
{
|
|
87
|
+
groups: [
|
|
88
|
+
[
|
|
89
|
+
"&",
|
|
90
|
+
"|",
|
|
91
|
+
"^",
|
|
92
|
+
"~",
|
|
93
|
+
"<<",
|
|
94
|
+
">>",
|
|
95
|
+
">>>"
|
|
96
|
+
],
|
|
97
|
+
[
|
|
98
|
+
"==",
|
|
99
|
+
"!=",
|
|
100
|
+
"===",
|
|
101
|
+
"!==",
|
|
102
|
+
">",
|
|
103
|
+
">=",
|
|
104
|
+
"<",
|
|
105
|
+
"<="
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"&&",
|
|
109
|
+
"||"
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
"in",
|
|
113
|
+
"instanceof"
|
|
114
|
+
]
|
|
115
|
+
],
|
|
116
|
+
allowSamePrecedence: false
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"no-multi-str": "warn",
|
|
120
|
+
"no-new-func": "warn",
|
|
121
|
+
"no-new-object": "warn",
|
|
122
|
+
"no-new-wrappers": "warn",
|
|
123
|
+
"no-octal-escape": "warn",
|
|
124
|
+
"no-param-reassign": "warn",
|
|
125
|
+
"no-restricted-properties": "warn",
|
|
126
|
+
"no-restricted-globals": [
|
|
127
|
+
"error"
|
|
128
|
+
],
|
|
129
|
+
"no-restricted-syntax": [
|
|
130
|
+
"error",
|
|
131
|
+
"WithStatement"
|
|
132
|
+
],
|
|
133
|
+
"no-script-url": "warn",
|
|
134
|
+
"no-sequences": "warn",
|
|
135
|
+
"no-shadow": "warn",
|
|
136
|
+
"no-throw-literal": "warn",
|
|
137
|
+
"no-unneeded-ternary": "warn",
|
|
138
|
+
"no-unused-expressions": [
|
|
139
|
+
"error",
|
|
140
|
+
{
|
|
141
|
+
allowShortCircuit: true,
|
|
142
|
+
allowTernary: true,
|
|
143
|
+
allowTaggedTemplates: true
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"no-useless-computed-key": "warn",
|
|
147
|
+
"no-useless-concat": "warn",
|
|
148
|
+
"no-useless-constructor": "warn",
|
|
149
|
+
"no-useless-rename": [
|
|
150
|
+
"warn",
|
|
151
|
+
{
|
|
152
|
+
ignoreDestructuring: false,
|
|
153
|
+
ignoreImport: false,
|
|
154
|
+
ignoreExport: false
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"no-var": "warn",
|
|
158
|
+
"prefer-const": "warn",
|
|
159
|
+
strict: [
|
|
160
|
+
"warn",
|
|
161
|
+
"never"
|
|
162
|
+
],
|
|
163
|
+
// Layout & Formatting
|
|
164
|
+
"unicode-bom": [
|
|
165
|
+
"warn",
|
|
166
|
+
"never"
|
|
167
|
+
],
|
|
168
|
+
// https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules
|
|
169
|
+
"import/newline-after-import": "warn",
|
|
170
|
+
"import/no-amd": "error",
|
|
171
|
+
"import/no-duplicates": "warn",
|
|
172
|
+
"import/no-self-import": "error",
|
|
173
|
+
"import/no-webpack-loader-syntax": "error",
|
|
174
|
+
// Positioned last to allow the consumer to override any rules.
|
|
175
|
+
...rules
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
];
|
|
179
|
+
return config;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export { coreConfig, coreGlobalIgnores };
|
|
183
|
+
|
|
184
|
+
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sources":["webpack://@workleap/eslint-configs/./src/core.ts"],"sourcesContent":["import js from \"@eslint/js\";\nimport type { Linter } from \"eslint\";\nimport importPlugin from \"eslint-plugin-import\";\nimport globals from \"globals\";\nimport type { ConfigWithExtends } from \"./types.ts\";\n\nexport interface CoreConfigOptions {\n rules?: Partial<Linter.RulesRecord>;\n}\n\nexport const coreGlobalIgnores = [];\n\nexport function coreConfig(options: CoreConfigOptions = {}) {\n const {\n rules\n } = options;\n\n const config: ConfigWithExtends[] = [{\n name: \"@workleap/eslint-configs/core\",\n files: [\n \"**/*.{js,jsx,ts,tsx,cjs,mjs}\"\n ],\n plugins: {\n js,\n import: importPlugin\n },\n extends: [\n js.configs.recommended\n ],\n languageOptions: {\n ecmaVersion: \"latest\",\n sourceType: \"module\",\n globals: {\n ...globals.browser,\n ...globals.es2024,\n ...globals.node,\n ...globals.commonjs\n }\n },\n rules: {\n // Recommended rules overrides\n \"no-cond-assign\": [\"error\", \"except-parens\"],\n \"no-labels\": [\"warn\", { allowLoop: true, allowSwitch: false }],\n \"no-prototype-builtins\": \"off\",\n\n // Possible problems\n \"array-callback-return\": \"error\",\n \"no-self-compare\": \"error\",\n \"no-template-curly-in-string\": \"error\",\n \"no-use-before-define\": [\n \"error\",\n {\n functions: false,\n classes: false,\n variables: false\n }\n ],\n\n // Suggestions\n curly: \"warn\",\n eqeqeq: [\"warn\", \"smart\"],\n \"no-array-constructor\": \"warn\",\n \"no-caller\": \"warn\",\n \"no-eval\": \"warn\",\n \"no-extend-native\": \"warn\",\n \"no-extra-bind\": \"warn\",\n \"no-extra-label\": \"warn\",\n \"no-implied-eval\": \"warn\",\n \"no-iterator\": \"warn\",\n \"no-label-var\": \"warn\",\n \"no-lone-blocks\": \"warn\",\n \"no-loop-func\": \"warn\",\n \"no-mixed-operators\": [\n \"warn\",\n {\n groups: [\n [\"&\", \"|\", \"^\", \"~\", \"<<\", \">>\", \">>>\"],\n [\"==\", \"!=\", \"===\", \"!==\", \">\", \">=\", \"<\", \"<=\"],\n [\"&&\", \"||\"],\n [\"in\", \"instanceof\"]\n ],\n allowSamePrecedence: false\n }\n ],\n \"no-multi-str\": \"warn\",\n \"no-new-func\": \"warn\",\n \"no-new-object\": \"warn\",\n \"no-new-wrappers\": \"warn\",\n \"no-octal-escape\": \"warn\",\n \"no-param-reassign\": \"warn\",\n \"no-restricted-properties\": \"warn\",\n \"no-restricted-globals\": [\"error\"],\n \"no-restricted-syntax\": [\"error\", \"WithStatement\"],\n \"no-script-url\": \"warn\",\n \"no-sequences\": \"warn\",\n \"no-shadow\": \"warn\",\n \"no-throw-literal\": \"warn\",\n \"no-unneeded-ternary\": \"warn\",\n \"no-unused-expressions\": [\n \"error\",\n {\n allowShortCircuit: true,\n allowTernary: true,\n allowTaggedTemplates: true\n }\n ],\n \"no-useless-computed-key\": \"warn\",\n \"no-useless-concat\": \"warn\",\n \"no-useless-constructor\": \"warn\",\n \"no-useless-rename\": [\n \"warn\",\n {\n ignoreDestructuring: false,\n ignoreImport: false,\n ignoreExport: false\n }\n ],\n \"no-var\": \"warn\",\n \"prefer-const\": \"warn\",\n strict: [\"warn\", \"never\"],\n\n // Layout & Formatting\n \"unicode-bom\": [\"warn\", \"never\"],\n\n // https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules\n \"import/newline-after-import\": \"warn\",\n \"import/no-amd\": \"error\",\n \"import/no-duplicates\": \"warn\",\n \"import/no-self-import\": \"error\",\n \"import/no-webpack-loader-syntax\": \"error\",\n\n // Positioned last to allow the consumer to override any rules.\n ...rules\n }\n }];\n\n return config;\n};\n"],"names":["js","importPlugin","globals","coreGlobalIgnores","coreConfig","options","rules","config"],"mappings":";;;;;;;;;;;AAA4B;AAEoB;AAClB;AAOvB,MAAMG,oBAAoB,EAAE,CAAC;AAE7B,SAASC,WAAWC,UAA6B,CAAC,CAAC;IACtD,MAAM,EACFC,KAAK,EACR,GAAGD;IAEJ,MAAME,SAA8B;QAAC;YACjC,MAAM;YACN,OAAO;gBACH;aACH;YACD,SAAS;gBACLP,EAAEA,EAAAA,EAAAA;gBACF,QAAQC,oBAAYA;YACxB;YACA,SAAS;gBACLD,sBAAsB;aACzB;YACD,iBAAiB;gBACb,aAAa;gBACb,YAAY;gBACZ,SAAS;oBACL,GAAGE,eAAe;oBAClB,GAAGA,cAAc;oBACjB,GAAGA,YAAY;oBACf,GAAGA,gBAAgB;gBACvB;YACJ;YACA,OAAO;gBACH,8BAA8B;gBAC9B,kBAAkB;oBAAC;oBAAS;iBAAgB;gBAC5C,aAAa;oBAAC;oBAAQ;wBAAE,WAAW;wBAAM,aAAa;oBAAM;iBAAE;gBAC9D,yBAAyB;gBAEzB,oBAAoB;gBACpB,yBAAyB;gBACzB,mBAAmB;gBACnB,+BAA+B;gBAC/B,wBAAwB;oBACpB;oBACA;wBACI,WAAW;wBACX,SAAS;wBACT,WAAW;oBACf;iBACH;gBAED,cAAc;gBACd,OAAO;gBACP,QAAQ;oBAAC;oBAAQ;iBAAQ;gBACzB,wBAAwB;gBACxB,aAAa;gBACb,WAAW;gBACX,oBAAoB;gBACpB,iBAAiB;gBACjB,kBAAkB;gBAClB,mBAAmB;gBACnB,eAAe;gBACf,gBAAgB;gBAChB,kBAAkB;gBAClB,gBAAgB;gBAChB,sBAAsB;oBAClB;oBACA;wBACI,QAAQ;4BACJ;gCAAC;gCAAK;gCAAK;gCAAK;gCAAK;gCAAM;gCAAM;6BAAM;4BACvC;gCAAC;gCAAM;gCAAM;gCAAO;gCAAO;gCAAK;gCAAM;gCAAK;6BAAK;4BAChD;gCAAC;gCAAM;6BAAK;4BACZ;gCAAC;gCAAM;6BAAa;yBACvB;wBACD,qBAAqB;oBACzB;iBACH;gBACD,gBAAgB;gBAChB,eAAe;gBACf,iBAAiB;gBACjB,mBAAmB;gBACnB,mBAAmB;gBACnB,qBAAqB;gBACrB,4BAA4B;gBAC5B,yBAAyB;oBAAC;iBAAQ;gBAClC,wBAAwB;oBAAC;oBAAS;iBAAgB;gBAClD,iBAAiB;gBACjB,gBAAgB;gBAChB,aAAa;gBACb,oBAAoB;gBACpB,uBAAuB;gBACvB,yBAAyB;oBACrB;oBACA;wBACI,mBAAmB;wBACnB,cAAc;wBACd,sBAAsB;oBAC1B;iBACH;gBACD,2BAA2B;gBAC3B,qBAAqB;gBACrB,0BAA0B;gBAC1B,qBAAqB;oBACjB;oBACA;wBACI,qBAAqB;wBACrB,cAAc;wBACd,cAAc;oBAClB;iBACH;gBACD,UAAU;gBACV,gBAAgB;gBAChB,QAAQ;oBAAC;oBAAQ;iBAAQ;gBAEzB,sBAAsB;gBACtB,eAAe;oBAAC;oBAAQ;iBAAQ;gBAEhC,yEAAyE;gBACzE,+BAA+B;gBAC/B,iBAAiB;gBACjB,wBAAwB;gBACxB,yBAAyB;gBACzB,mCAAmC;gBAEnC,+DAA+D;gBAC/D,GAAGI,KAAK;YACZ;QACJ;KAAE;IAEF,OAAOC;AACX"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { defineMonorepoWorkspaceConfig, type DefineMonorepoWorkspaceConfigOptions } from "./by-project-type/defineMonorepoWorkspaceConfig.ts";
|
|
2
|
+
export { defineReactLibraryConfig, type DefineReactLibraryConfigOptions } from "./by-project-type/defineReactLibraryConfig.ts";
|
|
3
|
+
export { defineTypeScriptLibraryConfig, type DefineTypeScriptLibraryConfigOptions } from "./by-project-type/defineTypescriptLibraryConfig.ts";
|
|
4
|
+
export { defineWebApplicationConfig, type DefineWebApplicationConfigOptions } from "./by-project-type/defineWebApplicationConfig.ts";
|
|
5
|
+
export type { CoreConfigOptions } from "./core.ts";
|
|
6
|
+
export type { JestConfigOptions } from "./jest.ts";
|
|
7
|
+
export type { JsxAllyConfigOptions } from "./jsxAlly.ts";
|
|
8
|
+
export type { PackageJsonConfigOptions } from "./packageJson.ts";
|
|
9
|
+
export type { ReactConfigOptions } from "./react.ts";
|
|
10
|
+
export type { StorybookConfigOptions } from "./storybook.ts";
|
|
11
|
+
export type { TestingLibraryConfigOptions } from "./testingLibrary.ts";
|
|
12
|
+
export type { ConfigWithExtends, ExtendsElement, InfiniteArray, SimpleExtendsElement } from "./types.ts";
|
|
13
|
+
export type { TypescriptConfigOptions } from "./typescript.ts";
|
|
14
|
+
export type { VitestConfigOptions } from "./vitest.ts";
|
|
15
|
+
export type { YamlConfigOptions } from "./yaml.ts";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineMonorepoWorkspaceConfig } from "./by-project-type/defineMonorepoWorkspaceConfig.js";
|
|
2
|
+
import { defineReactLibraryConfig } from "./by-project-type/defineReactLibraryConfig.js";
|
|
3
|
+
import { defineTypeScriptLibraryConfig } from "./by-project-type/defineTypescriptLibraryConfig.js";
|
|
4
|
+
import { defineWebApplicationConfig } from "./by-project-type/defineWebApplicationConfig.js";
|
|
5
|
+
|
|
6
|
+
;// CONCATENATED MODULE: external "./by-project-type/defineMonorepoWorkspaceConfig.js"
|
|
7
|
+
|
|
8
|
+
;// CONCATENATED MODULE: external "./by-project-type/defineReactLibraryConfig.js"
|
|
9
|
+
|
|
10
|
+
;// CONCATENATED MODULE: external "./by-project-type/defineTypescriptLibraryConfig.js"
|
|
11
|
+
|
|
12
|
+
;// CONCATENATED MODULE: external "./by-project-type/defineWebApplicationConfig.js"
|
|
13
|
+
|
|
14
|
+
;// CONCATENATED MODULE: ./src/index.ts
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export { defineMonorepoWorkspaceConfig, defineReactLibraryConfig, defineTypeScriptLibraryConfig, defineWebApplicationConfig };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["webpack://@workleap/eslint-configs/./src/index.ts"],"sourcesContent":["export { defineMonorepoWorkspaceConfig, type DefineMonorepoWorkspaceConfigOptions } from \"./by-project-type/defineMonorepoWorkspaceConfig.ts\";\nexport { defineReactLibraryConfig, type DefineReactLibraryConfigOptions } from \"./by-project-type/defineReactLibraryConfig.ts\";\nexport { defineTypeScriptLibraryConfig, type DefineTypeScriptLibraryConfigOptions } from \"./by-project-type/defineTypescriptLibraryConfig.ts\";\nexport { defineWebApplicationConfig, type DefineWebApplicationConfigOptions } from \"./by-project-type/defineWebApplicationConfig.ts\";\nexport type { CoreConfigOptions } from \"./core.ts\";\nexport type { JestConfigOptions } from \"./jest.ts\";\nexport type { JsxAllyConfigOptions } from \"./jsxAlly.ts\";\nexport type { PackageJsonConfigOptions } from \"./packageJson.ts\";\nexport type { ReactConfigOptions } from \"./react.ts\";\nexport type { StorybookConfigOptions } from \"./storybook.ts\";\nexport type { TestingLibraryConfigOptions } from \"./testingLibrary.ts\";\nexport type { ConfigWithExtends, ExtendsElement, InfiniteArray, SimpleExtendsElement } from \"./types.ts\";\nexport type { TypescriptConfigOptions } from \"./typescript.ts\";\nexport type { VitestConfigOptions } from \"./vitest.ts\";\nexport type { YamlConfigOptions } from \"./yaml.ts\";\n\n"],"names":["defineMonorepoWorkspaceConfig","defineReactLibraryConfig","defineTypeScriptLibraryConfig","defineWebApplicationConfig"],"mappings":";;;;;;;;;;;;;;AAA8I;AACf;AACe;AACT"}
|
package/dist/jest.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Linter } from "eslint";
|
|
2
|
+
import type { ConfigWithExtends } from "./types.ts";
|
|
3
|
+
export interface JestConfigOptions {
|
|
4
|
+
rules?: Partial<Linter.RulesRecord>;
|
|
5
|
+
}
|
|
6
|
+
export declare const jestGlobalIgnores: never[];
|
|
7
|
+
export declare function jestConfig(options?: JestConfigOptions): ConfigWithExtends[];
|
package/dist/jest.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import eslint_plugin_jest from "eslint-plugin-jest";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
|
|
4
|
+
;// CONCATENATED MODULE: external "eslint-plugin-jest"
|
|
5
|
+
|
|
6
|
+
;// CONCATENATED MODULE: external "globals"
|
|
7
|
+
|
|
8
|
+
;// CONCATENATED MODULE: ./src/jest.ts
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const jestGlobalIgnores = [];
|
|
12
|
+
function jestConfig(options = {}) {
|
|
13
|
+
const { rules = {} } = options;
|
|
14
|
+
const config = [
|
|
15
|
+
{
|
|
16
|
+
name: "@workleap/eslint-configs/jest",
|
|
17
|
+
files: [
|
|
18
|
+
"**/*.test.{js,jsx,ts,tsx}",
|
|
19
|
+
"**/*-test.{js,jsx,ts,tsx}",
|
|
20
|
+
"**/__tests__/*.{js,jsx,ts,tsx}",
|
|
21
|
+
"**/test.{js,jsx,ts,tsx}"
|
|
22
|
+
],
|
|
23
|
+
extends: [
|
|
24
|
+
eslint_plugin_jest.configs["flat/recommended"]
|
|
25
|
+
],
|
|
26
|
+
languageOptions: {
|
|
27
|
+
globals: {
|
|
28
|
+
...globals.browser,
|
|
29
|
+
...globals.es2024,
|
|
30
|
+
...globals.node,
|
|
31
|
+
...globals.commonjs,
|
|
32
|
+
...globals.jest
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
settings: {
|
|
36
|
+
jest: {
|
|
37
|
+
version: "detect"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
rules: {
|
|
41
|
+
// Gives better failure messages for array checks.
|
|
42
|
+
"jest/prefer-to-contain": "error",
|
|
43
|
+
// Prefer spies to allow for automatic restoration.
|
|
44
|
+
"jest/prefer-spy-on": "error",
|
|
45
|
+
// Positioned last to allow the consumer to override any rules.
|
|
46
|
+
...rules
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
];
|
|
50
|
+
return config;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { jestConfig, jestGlobalIgnores };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=jest.js.map
|
package/dist/jest.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.js","sources":["webpack://@workleap/eslint-configs/./src/jest.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\nimport jestPlugin from \"eslint-plugin-jest\";\nimport globals from \"globals\";\nimport type { ConfigWithExtends } from \"./types.ts\";\n\nexport interface JestConfigOptions {\n rules?: Partial<Linter.RulesRecord>;\n}\n\nexport const jestGlobalIgnores = [];\n\nexport function jestConfig(options: JestConfigOptions = {}) {\n const {\n rules = {}\n } = options;\n\n const config: ConfigWithExtends[] = [{\n name: \"@workleap/eslint-configs/jest\",\n files: [\n \"**/*.test.{js,jsx,ts,tsx}\",\n \"**/*-test.{js,jsx,ts,tsx}\",\n \"**/__tests__/*.{js,jsx,ts,tsx}\",\n \"**/test.{js,jsx,ts,tsx}\"\n ],\n extends: [\n jestPlugin.configs[\"flat/recommended\"]\n ],\n languageOptions: {\n globals: {\n ...globals.browser,\n ...globals.es2024,\n ...globals.node,\n ...globals.commonjs,\n ...globals.jest\n }\n },\n settings: {\n jest: {\n version: \"detect\"\n }\n },\n rules: {\n // Gives better failure messages for array checks.\n \"jest/prefer-to-contain\": \"error\",\n // Prefer spies to allow for automatic restoration.\n \"jest/prefer-spy-on\": \"error\",\n // Positioned last to allow the consumer to override any rules.\n ...rules\n }\n }];\n\n return config;\n};\n"],"names":["jestPlugin","globals","jestGlobalIgnores","jestConfig","options","rules","config"],"mappings":";;;;;;;;AAC4C;AACd;AAOvB,MAAME,oBAAoB,EAAE,CAAC;AAE7B,SAASC,WAAWC,UAA6B,CAAC,CAAC;IACtD,MAAM,EACFC,QAAQ,CAAC,CAAC,EACb,GAAGD;IAEJ,MAAME,SAA8B;QAAC;YACjC,MAAM;YACN,OAAO;gBACH;gBACA;gBACA;gBACA;aACH;YACD,SAAS;gBACLN,8CAAsC;aACzC;YACD,iBAAiB;gBACb,SAAS;oBACL,GAAGC,eAAe;oBAClB,GAAGA,cAAc;oBACjB,GAAGA,YAAY;oBACf,GAAGA,gBAAgB;oBACnB,GAAGA,YAAY;gBACnB;YACJ;YACA,UAAU;gBACN,MAAM;oBACF,SAAS;gBACb;YACJ;YACA,OAAO;gBACH,kDAAkD;gBAClD,0BAA0B;gBAC1B,mDAAmD;gBACnD,sBAAsB;gBACtB,+DAA+D;gBAC/D,GAAGI,KAAK;YACZ;QACJ;KAAE;IAEF,OAAOC;AACX"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Linter } from "eslint";
|
|
2
|
+
import type { ConfigWithExtends } from "./types.ts";
|
|
3
|
+
export interface JsxAllyConfigOptions {
|
|
4
|
+
rules?: Partial<Linter.RulesRecord>;
|
|
5
|
+
}
|
|
6
|
+
export declare const jsxAllyGlobalIgnores: never[];
|
|
7
|
+
export declare function jsxAllyConfig(options?: JsxAllyConfigOptions): ConfigWithExtends[];
|
package/dist/jsxAlly.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import eslint_plugin_jsx_a11y from "eslint-plugin-jsx-a11y";
|
|
2
|
+
|
|
3
|
+
;// CONCATENATED MODULE: external "eslint-plugin-jsx-a11y"
|
|
4
|
+
|
|
5
|
+
;// CONCATENATED MODULE: ./src/jsxAlly.ts
|
|
6
|
+
|
|
7
|
+
const jsxAllyGlobalIgnores = [];
|
|
8
|
+
function jsxAllyConfig(options = {}) {
|
|
9
|
+
const { rules = {} } = options;
|
|
10
|
+
const config = [
|
|
11
|
+
{
|
|
12
|
+
name: "@workleap/eslint-configs/jsx-a11y",
|
|
13
|
+
files: [
|
|
14
|
+
"**/*.{js,ts,jsx,tsx,cjs,mjs}"
|
|
15
|
+
],
|
|
16
|
+
extends: [
|
|
17
|
+
eslint_plugin_jsx_a11y.flatConfigs.recommended
|
|
18
|
+
],
|
|
19
|
+
languageOptions: {
|
|
20
|
+
parserOptions: {
|
|
21
|
+
ecmaFeatures: {
|
|
22
|
+
jsx: true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
// This rule ensures that all labels have an associated control that they are labeling.
|
|
28
|
+
// However, this rule causes a lot of false positive, since our current implementation of our company's design system
|
|
29
|
+
// does not use the "for" attribute in the label element and automatically add it inside Fields.
|
|
30
|
+
// Therefore, we are disabling this rule.
|
|
31
|
+
"jsx-a11y/label-has-associated-control:": "off",
|
|
32
|
+
// This rule ensures that all media elements have a <track> for captions.
|
|
33
|
+
// Since we don't use captions, we are disabling this rule.
|
|
34
|
+
"jsx-a11y/media-has-caption": "off",
|
|
35
|
+
// There is a really good article that describes the issues with autoFocus and why it should be avoided:
|
|
36
|
+
// https://brucelawson.co.uk/2009/the-accessibility-of-html-5-autofocus/
|
|
37
|
+
// However, this issue is with screen readers and not with keyboard navigation.
|
|
38
|
+
// In Workleap, we use autoFocus in a lot of places to improve the user experience.
|
|
39
|
+
// Therefore, we are disabling this rule.
|
|
40
|
+
"jsx-a11y/no-autofocus": "off",
|
|
41
|
+
// Positioned last to allow the consumer to override any rules.
|
|
42
|
+
...rules
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
return config;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { jsxAllyConfig, jsxAllyGlobalIgnores };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=jsxAlly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxAlly.js","sources":["webpack://@workleap/eslint-configs/./src/jsxAlly.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\nimport jsxA11yPlugin from \"eslint-plugin-jsx-a11y\";\nimport type { ConfigWithExtends } from \"./types.ts\";\n\nexport interface JsxAllyConfigOptions {\n rules?: Partial<Linter.RulesRecord>;\n}\n\nexport const jsxAllyGlobalIgnores = [];\n\nexport function jsxAllyConfig(options: JsxAllyConfigOptions = {}) {\n const {\n rules = {}\n } = options;\n\n const config: ConfigWithExtends[] = [{\n name: \"@workleap/eslint-configs/jsx-a11y\",\n files: [\n \"**/*.{js,ts,jsx,tsx,cjs,mjs}\"\n ],\n extends: [\n jsxA11yPlugin.flatConfigs.recommended\n ],\n languageOptions: {\n parserOptions: {\n ecmaFeatures: {\n jsx: true\n }\n }\n },\n rules: {\n // This rule ensures that all labels have an associated control that they are labeling.\n // However, this rule causes a lot of false positive, since our current implementation of our company's design system\n // does not use the \"for\" attribute in the label element and automatically add it inside Fields.\n // Therefore, we are disabling this rule.\n \"jsx-a11y/label-has-associated-control:\": \"off\",\n // This rule ensures that all media elements have a <track> for captions.\n // Since we don't use captions, we are disabling this rule.\n \"jsx-a11y/media-has-caption\": \"off\",\n // There is a really good article that describes the issues with autoFocus and why it should be avoided:\n // https://brucelawson.co.uk/2009/the-accessibility-of-html-5-autofocus/\n // However, this issue is with screen readers and not with keyboard navigation.\n // In Workleap, we use autoFocus in a lot of places to improve the user experience.\n // Therefore, we are disabling this rule.\n \"jsx-a11y/no-autofocus\": \"off\",\n // Positioned last to allow the consumer to override any rules.\n ...rules\n }\n }];\n\n return config;\n};\n"],"names":["jsxA11yPlugin","jsxAllyGlobalIgnores","jsxAllyConfig","options","rules","config"],"mappings":";;;;;AACmD;AAO5C,MAAMC,uBAAuB,EAAE,CAAC;AAEhC,SAASC,cAAcC,UAAgC,CAAC,CAAC;IAC5D,MAAM,EACFC,QAAQ,CAAC,CAAC,EACb,GAAGD;IAEJ,MAAME,SAA8B;QAAC;YACjC,MAAM;YACN,OAAO;gBACH;aACH;YACD,SAAS;gBACLL,8CAAqC;aACxC;YACD,iBAAiB;gBACb,eAAe;oBACX,cAAc;wBACV,KAAK;oBACT;gBACJ;YACJ;YACA,OAAO;gBACH,uFAAuF;gBACvF,qHAAqH;gBACrH,gGAAgG;gBAChG,yCAAyC;gBACzC,0CAA0C;gBAC1C,yEAAyE;gBACzE,2DAA2D;gBAC3D,8BAA8B;gBAC9B,wGAAwG;gBACxG,wEAAwE;gBACxE,+EAA+E;gBAC/E,mFAAmF;gBACnF,yCAAyC;gBACzC,yBAAyB;gBACzB,+DAA+D;gBAC/D,GAAGI,KAAK;YACZ;QACJ;KAAE;IAEF,OAAOC;AACX"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Linter } from "eslint";
|
|
2
|
+
import type { ConfigWithExtends } from "./types.ts";
|
|
3
|
+
export interface PackageJsonConfigOptions {
|
|
4
|
+
rules?: Partial<Linter.RulesRecord>;
|
|
5
|
+
}
|
|
6
|
+
export declare const packageJsonGlobalIgnores: never[];
|
|
7
|
+
export declare function packageJsonConfig(options?: PackageJsonConfigOptions): ConfigWithExtends[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import eslint_plugin_package_json from "eslint-plugin-package-json";
|
|
2
|
+
|
|
3
|
+
;// CONCATENATED MODULE: external "eslint-plugin-package-json"
|
|
4
|
+
|
|
5
|
+
;// CONCATENATED MODULE: ./src/packageJson.ts
|
|
6
|
+
|
|
7
|
+
const packageJsonGlobalIgnores = [];
|
|
8
|
+
function packageJsonConfig(options = {}) {
|
|
9
|
+
const { rules = {} } = options;
|
|
10
|
+
const config = [
|
|
11
|
+
{
|
|
12
|
+
name: "@workleap/eslint-configs/package-json",
|
|
13
|
+
files: [
|
|
14
|
+
"**/package.json"
|
|
15
|
+
],
|
|
16
|
+
extends: [
|
|
17
|
+
eslint_plugin_package_json.configs.recommended
|
|
18
|
+
],
|
|
19
|
+
rules: {
|
|
20
|
+
"package-json/order-properties": "off",
|
|
21
|
+
"package-json/prefer-repository-shorthand": "off",
|
|
22
|
+
"package-json/sort-collections": [
|
|
23
|
+
"error",
|
|
24
|
+
[
|
|
25
|
+
// Do not sort "scripts".
|
|
26
|
+
"devDependencies",
|
|
27
|
+
"dependencies",
|
|
28
|
+
"peerDependencies",
|
|
29
|
+
"config"
|
|
30
|
+
]
|
|
31
|
+
],
|
|
32
|
+
// Doesn't support "workspace:*" at the moment.
|
|
33
|
+
"package-json/valid-package-def": "off",
|
|
34
|
+
// I am not sure why, this rule is triggering errors for valid paths.
|
|
35
|
+
"package-json/valid-repository-directory": "off",
|
|
36
|
+
"package-json/valid-scripts": "off",
|
|
37
|
+
// Positioned last to allow the consumer to override any rules.
|
|
38
|
+
...rules
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
return config;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { packageJsonConfig, packageJsonGlobalIgnores };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=packageJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageJson.js","sources":["webpack://@workleap/eslint-configs/./src/packageJson.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\nimport packageJsonPlugin from \"eslint-plugin-package-json\";\nimport type { ConfigWithExtends } from \"./types.ts\";\n\nexport interface PackageJsonConfigOptions {\n rules?: Partial<Linter.RulesRecord>;\n}\n\nexport const packageJsonGlobalIgnores = [];\n\nexport function packageJsonConfig(options: PackageJsonConfigOptions = {}) {\n const {\n rules = {}\n } = options;\n\n const config: ConfigWithExtends[] = [{\n name: \"@workleap/eslint-configs/package-json\",\n files: [\n \"**/package.json\"\n ],\n extends: [\n packageJsonPlugin.configs.recommended\n ],\n rules: {\n \"package-json/order-properties\": \"off\",\n \"package-json/prefer-repository-shorthand\": \"off\",\n \"package-json/sort-collections\": [\n \"error\",\n [\n // Do not sort \"scripts\".\n \"devDependencies\",\n \"dependencies\",\n \"peerDependencies\",\n \"config\"\n ]\n ],\n // Doesn't support \"workspace:*\" at the moment.\n \"package-json/valid-package-def\": \"off\",\n // I am not sure why, this rule is triggering errors for valid paths.\n \"package-json/valid-repository-directory\": \"off\",\n \"package-json/valid-scripts\": \"off\",\n // Positioned last to allow the consumer to override any rules.\n ...rules\n }\n }];\n\n return config;\n};\n"],"names":["packageJsonPlugin","packageJsonGlobalIgnores","packageJsonConfig","options","rules","config"],"mappings":";;;;;AAC2D;AAOpD,MAAMC,2BAA2B,EAAE,CAAC;AAEpC,SAASC,kBAAkBC,UAAoC,CAAC,CAAC;IACpE,MAAM,EACFC,QAAQ,CAAC,CAAC,EACb,GAAGD;IAEJ,MAAME,SAA8B;QAAC;YACjC,MAAM;YACN,OAAO;gBACH;aACH;YACD,SAAS;gBACLL,8CAAqC;aACxC;YACD,OAAO;gBACH,iCAAiC;gBACjC,4CAA4C;gBAC5C,iCAAiC;oBAC7B;oBACA;wBACI,yBAAyB;wBACzB;wBACA;wBACA;wBACA;qBACH;iBACJ;gBACD,+CAA+C;gBAC/C,kCAAkC;gBAClC,qEAAqE;gBACrE,2CAA2C;gBAC3C,8BAA8B;gBAC9B,+DAA+D;gBAC/D,GAAGI,KAAK;YACZ;QACJ;KAAE;IAEF,OAAOC;AACX"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Rule } from "eslint";
|
|
2
|
+
export declare const sanitizePath: (filePath: string) => string;
|
|
3
|
+
export declare const splitPath: (filePath: string) => string[];
|
|
4
|
+
export declare function getFilePath(context: Rule.RuleContext): string;
|
|
5
|
+
export declare function getFileName(context: Rule.RuleContext): string;
|
|
6
|
+
declare const rule: Rule.RuleModule;
|
|
7
|
+
export { rule as strictCssModulesNamesRule };
|