Pārlūkot izejas kodu

Refactor: File structure updated.

lfabl 1 nedēļu atpakaļ
vecāks
revīzija
8368a4d8a5
6 mainītis faili ar 188 papildinājumiem un 187 dzēšanām
  1. 4 4
      babel.config.js
  2. 106 106
      eslint.config.mjs
  3. 0 1
      package.json
  4. 33 33
      tsconfig.json
  5. 41 41
      turbo.json
  6. 4 2
      version.mjs

+ 4 - 4
babel.config.js

@@ -1,12 +1,12 @@
 module.exports = {
     overrides: [
         {
-            exclude: /\/node_modules\//,
-            presets: ["module:react-native-builder-bob/babel-preset"]
+            presets: ["module:react-native-builder-bob/babel-preset"],
+            exclude: /\/node_modules\//
         },
         {
-            include: /\/node_modules\//,
-            presets: ["module:@react-native/babel-preset"]
+            presets: ["module:@react-native/babel-preset"],
+            include: /\/node_modules\//
         }
     ],
 };

+ 106 - 106
eslint.config.mjs

@@ -13,112 +13,35 @@ export default tseslint.config(
     {
         ignores: [
             "node_modules",
-            "dist",
-            "lib",
+            "version.mjs",
             ".history",
-            "version.mjs"
+            "dist",
+            "lib"
         ]
     },
     js.configs.recommended,
     ...tseslint.configs.recommended,
     {
-        files: [
-            "**/*.{ts,tsx,js,jsx}"
-        ],
-        plugins: {
-            react,
-            "react-hooks": reactHooks,
-            "jsx-a11y": jsxA11y,
-            import: importPlugin,
-            "local-rules": {
-                rules: localRulesPlugin.rules
-            }
-        },
-        languageOptions: {
-            ecmaVersion: "latest",
-            sourceType: "module",
-            parser: tseslint.parser,
-            parserOptions: {
-                ecmaFeatures: {
-                    jsx: true
-                }
-            },
-            globals: {
-                "clearInterval": "readonly",
-                "clearTimeout": "readonly",
-                "setInterval": "readonly",
-                "setTimeout": "readonly",
-                "FormData": "readonly",
-                "console": "readonly",
-                "__DEV__": "readonly",
-                "fetch": "readonly"
-            }
-        },
-        settings: {
-            react: {
-                version: "detect"
-            },
-            "import/resolver": {
-                typescript: {
-                    alwaysTryTypes: true,
-                    project: "./tsconfig.json"
-                }
-            }
-        },
         rules: {
             "local-rules/multiline-import-specifiers": "error",
             "local-rules/multiline-object-properties": "error",
             "local-rules/multiline-jsx-attributes": "error",
             "local-rules/multiline-array-elements": "error",
-            "local-rules/custom-import-order": "error",
-            "@typescript-eslint/no-namespace": "off",
-            "quotes": [
-                "error",
-                "double",
-                {
-                    "avoidEscape": true
-                }
-            ],
-            "semi": [
-                "error",
-                "always"
-            ],
-            "no-var": "error",
-            "prefer-const": "error",
-            "comma-spacing": [
-                "error",
-                {
-                    "before": false,
-                    "after": true
-                }
-            ],
-            "object-curly-spacing": [
-                "error",
-                "always"
-            ],
-            "indent": [
-                "error",
-                4,
-                {
-                    "SwitchCase": 1
-                }
-            ],
-            "no-trailing-spaces": [
-                "error",
-                {
-                    "skipBlankLines": false
-                }
-            ],
             "@typescript-eslint/no-empty-object-type": [
                 "error",
                 {
                     "allowInterfaces": "with-single-extends"
                 }
             ],
-            "eol-last": [
+            "object-property-newline": [
                 "error",
-                "always"
+                {
+                    "allowAllPropertiesOnSameLine": false
+                }
             ],
+            "local-rules/custom-import-order": "error",
+            "@typescript-eslint/no-namespace": "off",
+            "react/react-in-jsx-scope": "off",
             "object-curly-newline": [
                 "error",
                 {
@@ -144,12 +67,23 @@ export default tseslint.config(
                     }
                 }
             ],
-            "object-property-newline": [
+            "no-trailing-spaces": [
                 "error",
                 {
-                    "allowAllPropertiesOnSameLine": false
+                    "skipBlankLines": false
+                }
+            ],
+            "quotes": [
+                "error",
+                "double",
+                {
+                    "avoidEscape": true
                 }
             ],
+            "react/jsx-indent-props": [
+                "error",
+                4
+            ],
             "array-element-newline": [
                 "error",
                 {
@@ -161,16 +95,82 @@ export default tseslint.config(
                 "error",
                 "consistent"
             ],
+            "object-curly-spacing": [
+                "error",
+                "always"
+            ],
+            "prefer-const": "error",
+            "comma-spacing": [
+                "error",
+                {
+                    "before": false,
+                    "after": true
+                }
+            ],
+            "indent": [
+                "error",
+                4,
+                {
+                    "SwitchCase": 1
+                }
+            ],
             "react/jsx-indent": [
                 "error",
                 4
             ],
-            "react/jsx-indent-props": [
+            "no-var": "error",
+            "eol-last": [
                 "error",
-                4
+                "always"
             ],
-            "react/react-in-jsx-scope": "off"
-        }
+            "semi": [
+                "error",
+                "always"
+            ]
+        },
+        settings: {
+            "import/resolver": {
+                typescript: {
+                    project: "./tsconfig.json",
+                    alwaysTryTypes: true
+                }
+            },
+            react: {
+                version: "detect"
+            }
+        },
+        languageOptions: {
+            plugins: {
+                "local-rules": {
+                    rules: localRulesPlugin.rules
+                },
+                "react-hooks": reactHooks,
+                import: importPlugin,
+                "jsx-a11y": jsxA11y,
+                react
+            },
+            globals: {
+                "clearInterval": "readonly",
+                "clearTimeout": "readonly",
+                "setInterval": "readonly",
+                "setTimeout": "readonly",
+                "FormData": "readonly",
+                "__DEV__": "readonly",
+                "console": "readonly",
+                "fetch": "readonly"
+            },
+            parser: tseslint.parser,
+            ecmaVersion: "latest",
+            sourceType: "module",
+            parserOptions: {
+                ecmaFeatures: {
+                    jsx: true
+                }
+            }
+        },
+        files: [
+            "**/*.{ts,tsx,js,jsx}"
+        ]
     },
     {
         files: [
@@ -186,20 +186,7 @@ export default tseslint.config(
         }
     },
     {
-        files: [
-            "**/*.json"
-        ],
-        plugins: {
-            jsonc
-        },
-        languageOptions: {
-            parser: jsoncParser
-        },
         rules: {
-            "jsonc/indent": [
-                "error",
-                4
-            ],
             "jsonc/object-property-newline": [
                 "error",
                 {
@@ -224,7 +211,20 @@ export default tseslint.config(
             "jsonc/array-bracket-newline": [
                 "error",
                 "always"
+            ],
+            "jsonc/indent": [
+                "error",
+                4
             ]
+        },
+        languageOptions: {
+            parser: jsoncParser
+        },
+        files: [
+            "**/*.json"
+        ],
+        plugins: {
+            jsonc
         }
     }
 );

+ 0 - 1
package.json

@@ -123,7 +123,6 @@
         "html-webpack-plugin": "5.6.7",
         "jest": "29.6.3",
         "jsonc-eslint-parser": "2.4.1",
-        "prettier": "2.8.8",
         "react": "19.2.3",
         "react-dom": "19.2.3",
         "react-native": "0.85.3",

+ 33 - 33
tsconfig.json

@@ -1,54 +1,54 @@
 {
     "compilerOptions": {
-        "rootDir": ".",
-        "paths": {
-            "ncore-ui-kit": [
-                "./src/index"
-            ]
-        },
-        "types": [
-            "node"
-        ],
-        "outDir": "lib",
+        "forceConsistentCasingInFileNames": true,
         "declarationDir": "lib/typescript",
+        "noFallthroughCasesInSwitch": true,
+        "noUncheckedIndexedAccess": true,
+        "noStrictGenericChecks": false,
         "allowUnreachableCode": false,
-        "allowUnusedLabels": false,
-        "composite": true,
-        "declaration": true,
+        "moduleResolution": "bundler",
         "customConditions": [
             "react-native-strict-api"
         ],
+        "verbatimModuleSyntax": true,
+        "noImplicitUseStrict": false,
+        "noUnusedParameters": true,
+        "allowUnusedLabels": false,
+        "noImplicitReturns": true,
+        "resolveJsonModule": true,
         "esModuleInterop": true,
-        "forceConsistentCasingInFileNames": true,
+        "noUnusedLocals": true,
+        "paths": {
+            "ncore-ui-kit": [
+                "./src/index"
+            ]
+        },
+        "skipLibCheck": true,
+        "declaration": true,
+        "target": "ESNext",
+        "module": "ESNext",
         "jsx": "react-jsx",
+        "composite": true,
+        "noEmit": false,
+        "outDir": "lib",
+        "rootDir": ".",
+        "strict": true,
         "lib": [
             "ESNext",
             "dom"
         ],
-        "module": "ESNext",
-        "moduleResolution": "bundler",
-        "noEmit": false,
-        "noFallthroughCasesInSwitch": true,
-        "noImplicitReturns": true,
-        "noImplicitUseStrict": false,
-        "noStrictGenericChecks": false,
-        "noUncheckedIndexedAccess": true,
-        "noUnusedLocals": true,
-        "noUnusedParameters": true,
-        "resolveJsonModule": true,
-        "skipLibCheck": true,
-        "strict": true,
-        "target": "ESNext",
-        "verbatimModuleSyntax": true
+        "types": [
+            "node"
+        ]
     },
     "include": [
         "src/**/*.json",
-        "src/**/*",
-        "package.json"
+        "package.json",
+        "src/**/*"
     ],
     "exclude": [
+        "node_modules",
         "version.mjs",
-        "lib",
-        "node_modules"
+        "lib"
     ]
 }

+ 41 - 41
turbo.json

@@ -1,8 +1,8 @@
 {
     "$schema": "https://turbo.build/schema.json",
     "globalDependencies": [
-        ".nvmrc",
-        ".yarnrc.yml"
+        ".yarnrc.yml",
+        ".nvmrc"
     ],
     "globalEnv": [
         "NODE_ENV"
@@ -10,81 +10,81 @@
     "tasks": {
         "build:android": {
             "env": [
-                "ANDROID_HOME",
-                "ORG_GRADLE_PROJECT_newArchEnabled"
+                "ORG_GRADLE_PROJECT_newArchEnabled",
+                "ANDROID_HOME"
             ],
             "inputs": [
-                "package.json",
-                "android",
-                "!android/build",
-                "src/*.ts",
-                "src/*.tsx",
-                "example/mobile/package.json",
-                "example/mobile/android",
+                "!example/mobile/android/app/build",
                 "!example/mobile/android/.gradle",
                 "!example/mobile/android/build",
-                "!example/mobile/android/app/build"
+                "example/mobile/package.json",
+                "example/mobile/android",
+                "!android/build",
+                "package.json",
+                "src/*.tsx",
+                "src/*.ts",
+                "android"
             ],
             "outputs": [
-                "example/web/package.json",
-                "example/web/android",
+                "!example/web/android/app/build",
                 "!example/web/android/.gradle",
                 "!example/web/android/build",
-                "!example/web/android/app/build"
+                "example/web/package.json",
+                "example/web/android"
             ]
         },
         "build:ios": {
             "env": [
-                "RCT_NEW_ARCH_ENABLED",
+                "RCT_USE_PREBUILT_RNCORE",
                 "RCT_REMOVE_LEGACY_ARCH",
-                "RCT_USE_RN_DEP",
-                "RCT_USE_PREBUILT_RNCORE"
+                "RCT_NEW_ARCH_ENABLED",
+                "RCT_USE_RN_DEP"
             ],
             "inputs": [
+                "example/mobile/package.json",
+                "!example/mobile/ios/build",
+                "!example/mobile/ios/Pods",
+                "example/mobile/ios",
                 "package.json",
+                "src/*.tsx",
                 "*.podspec",
-                "ios",
                 "src/*.ts",
-                "src/*.tsx",
-                "example/mobile/package.json",
-                "example/mobile/ios",
-                "!example/mobile/ios/build",
-                "!example/mobile/ios/Pods"
+                "ios"
             ],
             "outputs": [
                 "example/web/package.json",
-                "example/web/ios",
                 "!example/web/ios/build",
-                "!example/web/ios/Pods"
+                "!example/web/ios/Pods",
+                "example/web/ios"
             ]
         },
         "build:web": {
             "inputs": [
-                "package.json",
-                "android",
-                "!android/build",
-                "src/*.ts",
-                "src/*.tsx",
-                "example/web/package.json",
-                "example/web/android",
+                "!example/web/android/app/build",
                 "!example/web/android/.gradle",
                 "!example/web/android/build",
-                "!example/web/android/app/build",
                 "example/web/package.json",
-                "example/web/ios",
+                "example/web/package.json",
                 "!example/web/ios/build",
-                "!example/web/ios/Pods"
+                "!example/web/ios/Pods",
+                "example/web/android",
+                "example/web/ios",
+                "!android/build",
+                "package.json",
+                "src/*.tsx",
+                "src/*.ts",
+                "android"
             ],
             "outputs": [
-                "example/mobile/package.json",
-                "example/mobile/android",
+                "!example/mobile/android/app/build",
                 "!example/mobile/android/.gradle",
                 "!example/mobile/android/build",
-                "!example/mobile/android/app/build",
                 "example/mobile/package.json",
-                "example/mobile/ios",
+                "example/mobile/package.json",
                 "!example/mobile/ios/build",
-                "!example/mobile/ios/Pods"
+                "!example/mobile/ios/Pods",
+                "example/mobile/android",
+                "example/mobile/ios"
             ]
         }
     }

+ 4 - 2
version.mjs

@@ -4,8 +4,8 @@ const rootPkg = JSON.parse(fs.readFileSync("./package.json"), "utf-8");
 const version = rootPkg.version;
 
 const targets = [
-    "./lib/module/package.json",
-    "./lib/typescript/package.json"
+    "./lib/typescript/package.json",
+    "./lib/module/package.json"
 ];
 
 targets.forEach(target => {
@@ -15,6 +15,7 @@ targets.forEach(target => {
         pkg.version = version;
 
         fs.writeFileSync(target, JSON.stringify(pkg, null, 2));
+
         console.log(`✅ ${target} güncellendi: version ${version} eklendi.`);
     }
 });
@@ -23,4 +24,5 @@ fs.writeFileSync("./lib/package.json", JSON.stringify({
     version: version,
     type: "module"
 }, null, 4));
+
 console.log(`✅ Main package.json eklendi.`);