chayns-toolkit 2.0.0-beta.10 → 2.0.0-beta.14

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/babel.js CHANGED
@@ -1,81 +1,70 @@
1
- const { declare } = require("@babel/helper-plugin-utils")
2
-
3
- module.exports = declare((api, options) => {
4
- api.assertVersion(7)
5
-
6
- const env = process.env.BABEL_ENV || process.env.NODE_ENV
7
-
8
- const {
9
- typescriptSupport = false,
10
- flowSupport = false,
11
- transformChaynsComponentsImports = true,
12
- transpileModules = false,
13
- reactRefreshSupport = true,
14
- } = options
15
-
16
- if (env === "test") {
17
- return { presets: [["@babel/env", { targets: { node: "current" } }]] }
18
- }
19
-
20
- return {
21
- presets: [
22
- [
23
- "@babel/env",
24
- {
25
- loose: true,
26
- bugfixes: true,
27
- modules: transpileModules,
28
- exclude: ["transform-typeof-symbol"],
29
- useBuiltIns: "usage",
30
- corejs: 3,
31
- },
32
- ],
33
- [
34
- "@babel/react",
35
- {
36
- runtime: "automatic",
37
- development: env !== "production",
38
- },
39
- ],
40
- flowSupport && "@babel/flow",
41
- typescriptSupport && "@babel/typescript",
42
- ].filter(Boolean),
43
- plugins: [
44
- transformChaynsComponentsImports && [
45
- "transform-imports",
46
- {
47
- "chayns-components": {
48
- // eslint-disable-next-line global-require
49
- transform: require("chayns-components/lib/utils/babel/resolveAbsoluteImport"),
50
- preventFullImport: true,
51
- },
52
- },
53
- ],
54
- "macros",
55
- "optimize-clsx",
56
- [
57
- "@babel/transform-runtime",
58
- {
59
- // eslint-disable-next-line global-require
60
- version: require("@babel/runtime/package.json").version,
61
- corejs: false,
62
- regenerator: true,
63
- },
64
- ],
65
- typescriptSupport && [
66
- "@babel/proposal-decorators",
67
- { legacy: true },
68
- ],
69
- env === "production" && "transform-react-remove-prop-types",
70
- reactRefreshSupport &&
71
- env !== "production" &&
72
- "react-refresh/babel",
73
- [
74
- "@babel/plugin-transform-spread",
75
- {
76
- loose: false,
77
- },
78
- ],
79
- ].filter(Boolean),
80
- }
81
- })
1
+ const { declare } = require("@babel/helper-plugin-utils")
2
+
3
+ module.exports = declare((api, options) => {
4
+ api.assertVersion(7)
5
+
6
+ const env = process.env.BABEL_ENV || process.env.NODE_ENV
7
+
8
+ const {
9
+ typescriptSupport = false,
10
+ flowSupport = false,
11
+ transpileModules = false,
12
+ reactRefreshSupport = true,
13
+ } = options
14
+
15
+ if (env === "test") {
16
+ return { presets: [["@babel/env", { targets: { node: "current" } }]] }
17
+ }
18
+
19
+ return {
20
+ presets: [
21
+ [
22
+ "@babel/env",
23
+ {
24
+ loose: true,
25
+ bugfixes: true,
26
+ modules: transpileModules,
27
+ exclude: ["transform-typeof-symbol"],
28
+ useBuiltIns: "usage",
29
+ corejs: 3,
30
+ },
31
+ ],
32
+ [
33
+ "@babel/react",
34
+ {
35
+ runtime: "automatic",
36
+ development: env !== "production",
37
+ },
38
+ ],
39
+ flowSupport && "@babel/flow",
40
+ typescriptSupport && "@babel/typescript",
41
+ ].filter(Boolean),
42
+ plugins: [
43
+ "macros",
44
+ "optimize-clsx",
45
+ [
46
+ "@babel/transform-runtime",
47
+ {
48
+ // eslint-disable-next-line global-require
49
+ version: require("@babel/runtime/package.json").version,
50
+ corejs: false,
51
+ regenerator: true,
52
+ },
53
+ ],
54
+ typescriptSupport && [
55
+ "@babel/proposal-decorators",
56
+ { legacy: true },
57
+ ],
58
+ env === "production" && "transform-react-remove-prop-types",
59
+ reactRefreshSupport &&
60
+ env !== "production" &&
61
+ "react-refresh/babel",
62
+ [
63
+ "@babel/plugin-transform-spread",
64
+ {
65
+ loose: false,
66
+ },
67
+ ],
68
+ ].filter(Boolean),
69
+ }
70
+ })
package/eslint/index.js CHANGED
@@ -1,62 +1,65 @@
1
- const path = require("path")
2
- const javascriptRules = require("./javascriptRules")
3
- const sharedRules = require("./sharedRules")
4
- const typescriptRules = require("./typescriptRules")
5
-
6
- // eslint-disable-next-line import/no-dynamic-require
7
- const packageJson = require(path.resolve("package.json"))
8
-
9
- const usesTypeScript = Object.keys({
10
- ...packageJson.dependencies,
11
- ...packageJson.devDependencies,
12
- }).includes("typescript")
13
-
14
- module.exports = {
15
- env: {
16
- browser: true,
17
- es6: true,
18
- },
19
- extends: ["airbnb", "airbnb/hooks", "prettier"],
20
- globals: { chayns: true },
21
- rules: { ...sharedRules, ...javascriptRules },
22
- parser: "@babel/eslint-parser",
23
- settings: {
24
- "import/resolver": {
25
- typescript: { project: "@(jsconfig|tsconfig).json" },
26
- },
27
- "import/extensions": [".js", ".jsx", ".ts", ".tsx"],
28
- },
29
- overrides: [
30
- usesTypeScript && {
31
- files: ["**/*.ts?(x)"],
32
- extends: [
33
- "airbnb-typescript",
34
- "airbnb/hooks",
35
- "plugin:@typescript-eslint/recommended",
36
- "plugin:@typescript-eslint/recommended-requiring-type-checking",
37
- "prettier",
38
- "plugin:import/typescript",
39
- ],
40
- rules: {
41
- ...sharedRules,
42
- ...typescriptRules,
43
- },
44
- parserOptions: {
45
- project: "./tsconfig.json",
46
- },
47
- },
48
- {
49
- files: ["**/*.@(test|spec).@(js|jsx|ts|tsx)"],
50
- env: { "jest/globals": true },
51
- plugins: ["jest"],
52
- rules: {
53
- ...sharedRules,
54
- "jest/no-disabled-tests": "warn",
55
- "jest/no-focused-tests": "error",
56
- "jest/no-identical-title": "error",
57
- "jest/prefer-to-have-length": "warn",
58
- "jest/valid-expect": "error",
59
- },
60
- },
61
- ].filter(Boolean),
62
- }
1
+ const path = require("path")
2
+ const javascriptRules = require("./javascriptRules")
3
+ const sharedRules = require("./sharedRules")
4
+ const typescriptRules = require("./typescriptRules")
5
+
6
+ // eslint-disable-next-line import/no-dynamic-require
7
+ const packageJson = require(path.resolve("package.json"))
8
+
9
+ const usesTypeScript = Object.keys({
10
+ ...packageJson.dependencies,
11
+ ...packageJson.devDependencies,
12
+ }).includes("typescript")
13
+
14
+ module.exports = {
15
+ env: {
16
+ browser: true,
17
+ es6: true,
18
+ },
19
+ extends: ["airbnb", "airbnb/hooks", "prettier"],
20
+ globals: { chayns: true },
21
+ rules: { ...sharedRules, ...javascriptRules },
22
+ parser: "@babel/eslint-parser",
23
+ parserOptions: {
24
+ requireConfigFile: false,
25
+ },
26
+ settings: {
27
+ "import/resolver": {
28
+ typescript: { project: "@(jsconfig|tsconfig).json" },
29
+ },
30
+ "import/extensions": [".js", ".jsx", ".ts", ".tsx"],
31
+ },
32
+ overrides: [
33
+ usesTypeScript && {
34
+ files: ["**/*.ts?(x)"],
35
+ extends: [
36
+ "airbnb-typescript",
37
+ "airbnb/hooks",
38
+ "plugin:@typescript-eslint/recommended",
39
+ "plugin:@typescript-eslint/recommended-requiring-type-checking",
40
+ "prettier",
41
+ "plugin:import/typescript",
42
+ ],
43
+ rules: {
44
+ ...sharedRules,
45
+ ...typescriptRules,
46
+ },
47
+ parserOptions: {
48
+ project: "./tsconfig.json",
49
+ },
50
+ },
51
+ {
52
+ files: ["**/*.@(test|spec).@(js|jsx|ts|tsx)"],
53
+ env: { "jest/globals": true },
54
+ plugins: ["jest"],
55
+ rules: {
56
+ ...sharedRules,
57
+ "jest/no-disabled-tests": "warn",
58
+ "jest/no-focused-tests": "error",
59
+ "jest/no-identical-title": "error",
60
+ "jest/prefer-to-have-length": "warn",
61
+ "jest/valid-expect": "error",
62
+ },
63
+ },
64
+ ].filter(Boolean),
65
+ }