diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..69bf6b6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true +end_of_line = lf +indent_style = space +indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js index e928b86..5a0c99a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,9 +1,9 @@ // This configuration only applies to the package manager root. /** @type {import("eslint").Linter.Config} */ module.exports = { - ignorePatterns: ["apps/**", "packages/**"], - extends: ["@repo/eslint-config/library.js"], - parser: "@typescript-eslint/parser", + ignorePatterns: ['configs/**', 'packages/**', 'tests/**'], + extends: ['@repo/eslint-config/library.js'], + parser: '@typescript-eslint/parser', parserOptions: { project: true, }, diff --git a/.prettierrc.toml b/.prettierrc.toml new file mode 100644 index 0000000..3c3b765 --- /dev/null +++ b/.prettierrc.toml @@ -0,0 +1,3 @@ +trailingComma = "es5" +semi = true +singleQuote = true diff --git a/configs/eslint-config/library.js b/configs/eslint-config/library.js index c667cd1..8b0c63a 100644 --- a/configs/eslint-config/library.js +++ b/configs/eslint-config/library.js @@ -1,11 +1,11 @@ -const { resolve } = require("node:path"); +const { resolve } = require('node:path'); -const project = resolve(process.cwd(), "tsconfig.json"); +const project = resolve(process.cwd(), 'tsconfig.json'); /** @type {import("eslint").Linter.Config} */ module.exports = { - extends: ["eslint:recommended", "prettier", "eslint-config-turbo"], - plugins: ["only-warn"], + extends: ['eslint:recommended', 'prettier', 'eslint-config-turbo'], + plugins: ['only-warn'], globals: { React: true, JSX: true, @@ -14,7 +14,7 @@ module.exports = { node: true, }, settings: { - "import/resolver": { + 'import/resolver': { typescript: { project, }, @@ -22,13 +22,13 @@ module.exports = { }, ignorePatterns: [ // Ignore dotfiles - ".*.js", - "node_modules/", - "dist/", + '.*.js', + 'node_modules/', + 'dist/', ], overrides: [ { - files: ["*.js?(x)", "*.ts?(x)"], + files: ['*.js?(x)', '*.ts?(x)'], }, ], }; diff --git a/configs/eslint-config/react-internal.js b/configs/eslint-config/react-internal.js index f56c924..19b5fb8 100644 --- a/configs/eslint-config/react-internal.js +++ b/configs/eslint-config/react-internal.js @@ -1,6 +1,6 @@ -const { resolve } = require("node:path"); +const { resolve } = require('node:path'); -const project = resolve(process.cwd(), "tsconfig.json"); +const project = resolve(process.cwd(), 'tsconfig.json'); /* * This is a custom ESLint configuration for use with @@ -14,8 +14,8 @@ const project = resolve(process.cwd(), "tsconfig.json"); /** @type {import("eslint").Linter.Config} */ module.exports = { - extends: ["eslint:recommended", "prettier", "eslint-config-turbo"], - plugins: ["only-warn"], + extends: ['eslint:recommended', 'prettier', 'eslint-config-turbo'], + plugins: ['only-warn'], globals: { React: true, JSX: true, @@ -24,7 +24,7 @@ module.exports = { browser: true, }, settings: { - "import/resolver": { + 'import/resolver': { typescript: { project, }, @@ -32,12 +32,12 @@ module.exports = { }, ignorePatterns: [ // Ignore dotfiles - ".*.js", - "node_modules/", - "dist/", + '.*.js', + 'node_modules/', + 'dist/', ], overrides: [ // Force ESLint to detect .tsx files - { files: ["*.js?(x)", "*.ts?(x)"] }, + { files: ['*.js?(x)', '*.ts?(x)'] }, ], }; diff --git a/package.json b/package.json index 04c3344..de7a3ef 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "scripts": { "build": "turbo build", "lint": "turbo lint -- --max-warnings=0", - "format": "prettier --write \"**/*.{ts,tsx,md}\"", - "format:check": "prettier --check \"**/*.{ts,tsx,md}\"" + "format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,json}\"", + "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,md,json}\"" }, "devDependencies": { "@manypkg/cli": "^0.21.1", diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js new file mode 100644 index 0000000..6135f38 --- /dev/null +++ b/packages/core/.eslintrc.js @@ -0,0 +1,9 @@ +/** @type {import("eslint").Linter.Config} */ +module.exports = { + root: true, + extends: ['@repo/eslint-config/react-internal.js'], + parser: '@typescript-eslint/parser', + parserOptions: { + project: './tsconfig.lint.json', + }, +}; diff --git a/packages/core/package.json b/packages/core/package.json new file mode 100644 index 0000000..a582126 --- /dev/null +++ b/packages/core/package.json @@ -0,0 +1,44 @@ +{ + "name": "@sugarform/core", + "version": "0.1.0", + "description": "Sugarform is Uncontrolled, Growth-ready, And Reusable form framework of react.", + "repository": { + "type": "git", + "url": "git+https://github.com/sugarform-dev/sugarform.git" + }, + "author": "aspulse ", + "keywords": [ + "react", + "front-end" + ], + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "sideEffects": false, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js", + "import": "./dist/index.mjs" + } + }, + "files": [ + "dist" + ], + "scripts": { + "typecheck": "tsc --noEmit --composite false", + "lint": "eslint ." + }, + "peerDependencies": { + "@types/react": "^18.0.0", + "react": "^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + }, + "publishConfig": { + "access": "public" + } +}