chayns-toolkit 2.0.0-beta.7 → 2.0.0-beta.8

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.
Files changed (4) hide show
  1. package/babel.js +81 -81
  2. package/eslint/index.js +62 -62
  3. package/lib/cli.js +37 -35
  4. package/package.json +10 -10
package/babel.js CHANGED
@@ -1,81 +1,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
- 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
+ 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
+ })
package/eslint/index.js CHANGED
@@ -1,62 +1,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
- 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
+ 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
+ }