@bigbinary/neeto-commons-frontend 2.0.37 → 2.0.38
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/configs/nanos/eslint/helpers/index.js +49 -0
- package/configs/nanos/eslint/imports/order.js +18 -0
- package/configs/nanos/eslint/index.js +23 -0
- package/configs/nanos/eslint/neeto.js +92 -0
- package/configs/nanos/tailwind.js +11 -0
- package/configs/nanos/webpack/resolve.js +42 -0
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const { mergeDeepLeft, mergeLeft, keys } = require("ramda");
|
|
5
|
+
|
|
6
|
+
const rootOfTheProject = path.join(__dirname, "../../../../../../../");
|
|
7
|
+
|
|
8
|
+
const loadJS = jsPath => {
|
|
9
|
+
try {
|
|
10
|
+
return require(path.join(rootOfTheProject, jsPath));
|
|
11
|
+
} catch {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const doesFileExist = filePath =>
|
|
17
|
+
fs.existsSync(filePath) && fs.lstatSync(filePath).isFile();
|
|
18
|
+
|
|
19
|
+
const buildPathGroupsBasedOnWebpackAliases = ({
|
|
20
|
+
customAliasPath = "resolve.js",
|
|
21
|
+
}) => {
|
|
22
|
+
const projectResolve = loadJS(customAliasPath);
|
|
23
|
+
const commonResolve = loadJS(
|
|
24
|
+
"node_modules/@bigbinary/neeto-commons-frontend/configs/nanos/webpack/resolve.js"
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const { dependencies = [], devDependencies = [] } = loadJS("package.json");
|
|
28
|
+
const packages = keys(mergeLeft(dependencies, devDependencies));
|
|
29
|
+
const { alias = {}, extensions = [] } = mergeDeepLeft(
|
|
30
|
+
projectResolve,
|
|
31
|
+
commonResolve
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return Object.entries(alias).flatMap(([pattern, aliasPath]) => {
|
|
35
|
+
const group = packages.includes(aliasPath) ? "external" : "internal";
|
|
36
|
+
const isFile = ["", ...extensions].some(extension =>
|
|
37
|
+
doesFileExist(`${aliasPath}${extension}`)
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
if (isFile) return { pattern, group };
|
|
41
|
+
|
|
42
|
+
return [
|
|
43
|
+
{ pattern, group },
|
|
44
|
+
{ pattern: `${pattern}/**`, group },
|
|
45
|
+
];
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
module.exports = { buildPathGroupsBasedOnWebpackAliases };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { assocPath } = require("ramda");
|
|
2
|
+
|
|
3
|
+
const commonConfig = require("../../../eslint/imports/order");
|
|
4
|
+
const { buildPathGroupsBasedOnWebpackAliases } = require("../helpers");
|
|
5
|
+
|
|
6
|
+
const pathGroups = buildPathGroupsBasedOnWebpackAliases({});
|
|
7
|
+
const pathGroupForKeepingReactImportsAtTop = {
|
|
8
|
+
pattern: "react+(-native|)",
|
|
9
|
+
group: "external",
|
|
10
|
+
position: "before",
|
|
11
|
+
};
|
|
12
|
+
pathGroups.push(pathGroupForKeepingReactImportsAtTop);
|
|
13
|
+
|
|
14
|
+
module.exports = assocPath(
|
|
15
|
+
["rules", "import/order", 1, "pathGroups"],
|
|
16
|
+
pathGroups,
|
|
17
|
+
commonConfig
|
|
18
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const { mergeLeft } = require("ramda");
|
|
2
|
+
|
|
3
|
+
const commonConfiguration = require("../../eslint");
|
|
4
|
+
|
|
5
|
+
const nanosConfiguration = {
|
|
6
|
+
extends: [
|
|
7
|
+
"plugin:@bigbinary/neeto/recommended",
|
|
8
|
+
"plugin:cypress/recommended",
|
|
9
|
+
"plugin:json/recommended",
|
|
10
|
+
"eslint:recommended",
|
|
11
|
+
"plugin:react/recommended",
|
|
12
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/globals",
|
|
13
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/nanos/eslint/imports/order",
|
|
14
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/overrides",
|
|
15
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/imports/enforced",
|
|
16
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/react",
|
|
17
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/promise",
|
|
18
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/nanos/eslint/neeto",
|
|
19
|
+
"prettier",
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
module.exports = mergeLeft(nanosConfiguration, commonConfiguration);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
const { mergeDeepLeft } = require("ramda");
|
|
4
|
+
|
|
5
|
+
const rootOfTheProject = path.join(__dirname, "../../../../../../");
|
|
6
|
+
const pathToTranslationFile = "src/translations/en.json";
|
|
7
|
+
const pathToResolveFile = "resolve.js";
|
|
8
|
+
const pathToJsConfigFile = "jsconfig.json";
|
|
9
|
+
|
|
10
|
+
const loadJS = jsPath => {
|
|
11
|
+
try {
|
|
12
|
+
return require(path.join(rootOfTheProject, jsPath));
|
|
13
|
+
} catch {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const commonResolve = loadJS(
|
|
19
|
+
"node_modules/@bigbinary/neeto-commons-frontend/configs/nanos/webpack/resolve.js"
|
|
20
|
+
);
|
|
21
|
+
const projectResolve = loadJS(pathToResolveFile);
|
|
22
|
+
const en = loadJS(pathToTranslationFile);
|
|
23
|
+
const resolve = mergeDeepLeft(projectResolve, commonResolve);
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
rules: {
|
|
27
|
+
"@bigbinary/neeto/file-name-and-export-name-standards": [
|
|
28
|
+
"warn",
|
|
29
|
+
{
|
|
30
|
+
basePath: path.join(rootOfTheProject, "src"),
|
|
31
|
+
default: {
|
|
32
|
+
filenameCase: "camelCase",
|
|
33
|
+
exportnameCase: "camelCase",
|
|
34
|
+
},
|
|
35
|
+
configs: [
|
|
36
|
+
{
|
|
37
|
+
filenameCase: "camelCase",
|
|
38
|
+
exportnameCase: "CONSTANT_CASE",
|
|
39
|
+
includes: ["/**/constants.{js,jsx}", "/**/constants/**"],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
filenameCase: "camelCase",
|
|
43
|
+
includes: ["/**/utils.{js,jsx}", "/**/utils/**"],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
filenameCase: "snake_case",
|
|
47
|
+
exportnameCase: "camelCase",
|
|
48
|
+
includes: "/apis/**",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
filenameCase: "camelCase",
|
|
52
|
+
exportnameCase: "camelCase",
|
|
53
|
+
includes: "/channels/**",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
filenameCase: "camelCase",
|
|
57
|
+
exportnameCase: "camelCase",
|
|
58
|
+
includes: "/**/hooks/**",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
filenameCase: "camelCase",
|
|
62
|
+
includes: "/lib/**",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
filenameCase: "camelCase",
|
|
66
|
+
exportnameCase: "camelCase",
|
|
67
|
+
includes: "/**/stores/**",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
filenameCase: "PascalCase",
|
|
71
|
+
exportnameCase: "PascalCase",
|
|
72
|
+
includes: ["/components/**", "/*.jsx"],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
"@bigbinary/neeto/no-axios-import-outside-apis": ["error", resolve.alias],
|
|
78
|
+
"@bigbinary/neeto/no-missing-localization": [
|
|
79
|
+
"error",
|
|
80
|
+
{ name: "en.json", lng: "en", content: en },
|
|
81
|
+
],
|
|
82
|
+
"@bigbinary/neeto/prefix-neeto-ui-import-alias": ["error", resolve.alias],
|
|
83
|
+
"@bigbinary/neeto/use-webpack-alias": ["error", resolve.alias],
|
|
84
|
+
"@bigbinary/neeto/webpack-aliases-and-jsconfig-paths-should-be-in-sync": [
|
|
85
|
+
"error",
|
|
86
|
+
{
|
|
87
|
+
jsconfigFilePath: path.join(rootOfTheProject, pathToJsConfigFile),
|
|
88
|
+
aliasFilePath: path.join(rootOfTheProject, pathToResolveFile),
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
important: true,
|
|
3
|
+
purge: {
|
|
4
|
+
enabled: process.env.NODE_ENV === "production",
|
|
5
|
+
content: [
|
|
6
|
+
"./{src,example}/**/*.{js,jsx}",
|
|
7
|
+
"./node_modules/@bigbinary/**/*.js",
|
|
8
|
+
],
|
|
9
|
+
defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [],
|
|
10
|
+
},
|
|
11
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
const absolutePath = basePath =>
|
|
4
|
+
path.join(__dirname, "../../../../../../", basePath);
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
alias: {
|
|
8
|
+
apis: absolutePath("src/apis"),
|
|
9
|
+
assets: absolutePath("src/assets"),
|
|
10
|
+
components: absolutePath("src/components"),
|
|
11
|
+
hooks: absolutePath("src/hooks"),
|
|
12
|
+
reducers: absolutePath("src/reducers"),
|
|
13
|
+
routes: absolutePath("src/routes"),
|
|
14
|
+
stores: absolutePath("src/stores"),
|
|
15
|
+
translations: absolutePath("src/translations"),
|
|
16
|
+
utils: absolutePath("src/utils"),
|
|
17
|
+
src: absolutePath("src"),
|
|
18
|
+
neetoui: "@bigbinary/neetoui",
|
|
19
|
+
neetocommons: "@bigbinary/neeto-commons-frontend",
|
|
20
|
+
neetoicons: "@bigbinary/neeto-icons",
|
|
21
|
+
neetoteam: "@bigbinary/neeto-team-members-frontend",
|
|
22
|
+
neetoeditor: "@bigbinary/neeto-editor",
|
|
23
|
+
neetofilters: "@bigbinary/neeto-filters-frontend",
|
|
24
|
+
},
|
|
25
|
+
extensions: [
|
|
26
|
+
".ts",
|
|
27
|
+
".mjs",
|
|
28
|
+
".js",
|
|
29
|
+
".jsx",
|
|
30
|
+
".sass",
|
|
31
|
+
".scss",
|
|
32
|
+
".css",
|
|
33
|
+
".module.sass",
|
|
34
|
+
".module.scss",
|
|
35
|
+
".module.css",
|
|
36
|
+
".png",
|
|
37
|
+
".svg",
|
|
38
|
+
".gif",
|
|
39
|
+
".jpeg",
|
|
40
|
+
".jpg",
|
|
41
|
+
],
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-commons-frontend",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.38",
|
|
4
4
|
"description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|