diff --git a/.eslintignore b/.eslintignore index 2a542182..b015a538 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,7 @@ flow-typed/* lib/* build/* -website/* +#website/* #dont ignore website (like sidebars.js) +website/build/* coverage/* -*.js +#*.js # dont ignore top-level js files diff --git a/.eslintrc.js b/.eslintrc.js index a120008f..eb54f8e9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,18 +1,14 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ const path = require('path'); module.exports = { parser: '@typescript-eslint/parser', plugins: ['@typescript-eslint', 'prettier'], - extends: [ - 'plugin:@typescript-eslint/recommended', - 'plugin:prettier/recommended', - ], + extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], parserOptions: { sourceType: 'module', useJSXTextNode: true, - project: [ - path.resolve(__dirname, 'tsconfig.json'), - ], + project: [path.resolve(__dirname, 'tsconfig.json')], }, rules: { 'no-underscore-dangle': 0, @@ -43,37 +39,55 @@ module.exports = { '@typescript-eslint/no-use-before-define': 0, '@typescript-eslint/no-empty-function': 0, '@typescript-eslint/explicit-module-boundary-types': 0, - 'curly': ['error', 'all'], + curly: ['error', 'all'], 'padding-line-between-statements': [ - "warn", + 'warn', { - blankLine: 'always', prev: '*', next: 'return' // add blank line *before* all returns (if there are statements before) + blankLine: 'always', + prev: '*', + next: 'return', // add blank line *before* all returns (if there are statements before) }, { - blankLine: 'always', prev: '*', next: 'if' // add blank line *before* all ifs + blankLine: 'always', + prev: '*', + next: 'if', // add blank line *before* all ifs }, { - blankLine: 'always', prev: 'if', next: '*' // add blank line *after* all ifs + blankLine: 'always', + prev: 'if', + next: '*', // add blank line *after* all ifs }, { - blankLine: 'any', prev: 'if', next: 'if' // allow blank line between ifs, but not enforce either + blankLine: 'any', + prev: 'if', + next: 'if', // allow blank line between ifs, but not enforce either }, { - blankLine: 'always', prev: '*', next: ['function', 'class'] // add blank line *before* all functions and classes + blankLine: 'always', + prev: '*', + next: ['function', 'class'], // add blank line *before* all functions and classes }, { - blankLine: 'always', prev: ['function', 'class'], next: '*' // add blank line *after* all functions and classes + blankLine: 'always', + prev: ['function', 'class'], + next: '*', // add blank line *after* all functions and classes }, { - blankLine: 'always', prev: '*', next: 'import' // add blank line *before* all imports + blankLine: 'always', + prev: '*', + next: 'import', // add blank line *before* all imports }, { - blankLine: 'always', prev: 'import', next: '*' // add blank line *after* all imports + blankLine: 'always', + prev: 'import', + next: '*', // add blank line *after* all imports }, { - blankLine: 'never', prev: 'import', next: 'import' // dont allow blank line between imports + blankLine: 'never', + prev: 'import', + next: 'import', // dont allow blank line between imports }, - ] + ], }, env: { node: true, diff --git a/commitlint.config.js b/commitlint.config.js index 6b3114e4..e61b6f4a 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,11 +1,9 @@ module.exports = { - "extends": [ - "@commitlint/config-conventional" - ], - "rules": { - "scope-case": [0, "never"], - "body-min-length": [2, "always", 3], - "footer-max-line-length": [1, "always", 200], - "type-enum": [2, "always", ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'revert', 'dependencies', 'release']] - } + extends: ['@commitlint/config-conventional'], + rules: { + 'scope-case': [0, 'never'], + 'body-min-length': [2, 'always', 3], + 'footer-max-line-length': [1, 'always', 200], + 'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'revert', 'dependencies', 'release']], + }, }; diff --git a/lint-staged.config.js b/lint-staged.config.js index 535d947b..338f5f38 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -1,3 +1,3 @@ module.exports = { - "**/*.{ts,js}": "yarn run lint --fix" + '**/*.{ts,js}': 'yarn run lint --fix', }; diff --git a/tsconfig.build.json b/tsconfig.build.json index 9ac6e181..200344d2 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,7 +1,8 @@ { "extends": "./tsconfig.json", "exclude": [ - "test/**/*.ts" + "test/**/*.ts", + "*.js" ], "compilerOptions": { "outDir": "lib" diff --git a/tsconfig.json b/tsconfig.json index cd7d0064..f576dd32 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,9 +21,13 @@ }, "include": [ "src/**/*.ts", - "test/**/*.ts" + "test/**/*.ts", + "*.js", + ".*.js", + "website/**/*.js" ], "exclude": [ - "node_modules/**/*" + "**/*/node_modules/**/*", + "website/build/**/*" ] } diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 26ea2f30..d0ceeaa2 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -56,7 +56,7 @@ module.exports = { { label: 'Discord', href: 'https://discord.gg/BpGjTTD', - } + }, ], }, { diff --git a/website/sidebars.js b/website/sidebars.js index cb36046b..286246a8 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -1,15 +1,50 @@ module.exports = { docs: { - Start: ["api/index-api", "api/virtuals", "api/environment-variables"], - Decorators: ["api/decorators/prop", "api/decorators/model-options", "api/decorators/hooks", "api/decorators/indexes", "api/decorators/plugins", "api/decorators/query-method"], - Functions: ["api/functions/get-model-for-class", "api/functions/get-class-for-document", "api/functions/get-class", "api/functions/build-schema", "api/functions/get-discriminator-model-for-class", "api/functions/add-model-to-typegoose", "api/functions/delete-model", "api/functions/set-global-options", "api/functions/get-model-with-string", "api/functions/get-name"], - TypeGuards: ["api/functions/typeguards/is-document", "api/functions/typeguards/is-ref-type"], - Types: ["api/types/document-type", "api/types/return-model-type", "api/types/ref-type", "api/types/additional-types"] + Start: ['api/index-api', 'api/virtuals', 'api/environment-variables'], + Decorators: [ + 'api/decorators/prop', + 'api/decorators/model-options', + 'api/decorators/hooks', + 'api/decorators/indexes', + 'api/decorators/plugins', + 'api/decorators/query-method', + ], + Functions: [ + 'api/functions/get-model-for-class', + 'api/functions/get-class-for-document', + 'api/functions/get-class', + 'api/functions/build-schema', + 'api/functions/get-discriminator-model-for-class', + 'api/functions/add-model-to-typegoose', + 'api/functions/delete-model', + 'api/functions/set-global-options', + 'api/functions/get-model-with-string', + 'api/functions/get-name', + ], + TypeGuards: ['api/functions/typeguards/is-document', 'api/functions/typeguards/is-ref-type'], + Types: ['api/types/document-type', 'api/types/return-model-type', 'api/types/ref-type', 'api/types/additional-types'], }, guides: { - "Getting Started": ["guides/quick-start-guide", "guides/faq", "guides/known-issues", "guides/deprecation-codes", "guides/error-warning-details"], - Basics: ["guides/all-decorators", "guides/motivation", "guides/default-classes", "guides/use-without-emitDecoratorMetadata"], - Advanced: ["guides/advanced/custom-types", "guides/advanced/array-types", "guides/advanced/models-with-same-name", "guides/advanced/logger", "guides/advanced/reference-other-classes", "guides/advanced/common-plugins", "guides/advanced/change-id-type", "guides/advanced/using-objectid-type", "guides/advanced/using-with-class-transformer", "guides/advanced/non-nested-discriminators"], - Migration: ["guides/mongoose-compatibility", "guides/migrate-8", "guides/migrate-7", "guides/migrate-6"] - } + 'Getting Started': [ + 'guides/quick-start-guide', + 'guides/faq', + 'guides/known-issues', + 'guides/deprecation-codes', + 'guides/error-warning-details', + ], + Basics: ['guides/all-decorators', 'guides/motivation', 'guides/default-classes', 'guides/use-without-emitDecoratorMetadata'], + Advanced: [ + 'guides/advanced/custom-types', + 'guides/advanced/array-types', + 'guides/advanced/models-with-same-name', + 'guides/advanced/logger', + 'guides/advanced/reference-other-classes', + 'guides/advanced/common-plugins', + 'guides/advanced/change-id-type', + 'guides/advanced/using-objectid-type', + 'guides/advanced/using-with-class-transformer', + 'guides/advanced/non-nested-discriminators', + ], + Migration: ['guides/mongoose-compatibility', 'guides/migrate-8', 'guides/migrate-7', 'guides/migrate-6'], + }, }; diff --git a/website/src/pages/index.js b/website/src/pages/index.js index 2233ca71..9d483607 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -9,34 +9,22 @@ import styles from './styles.module.css'; const features = [ { title: <>Easy to Use>, - description: ( - <> - Typegoose was designed to easily use mongoose schema's & model's in typescript - > - ), + description: <>Typegoose was designed to easily use mongoose schema's & model's in typescript>, }, { title: <>Focus on What Matters>, - description: ( - <> - Typegoose lets you focus on your data, and typegoose will create the correct - mappings to schema's and model's - > - ), + description: <>Typegoose lets you focus on your data, and typegoose will create the correct mappings to schema's and model's>, }, { // didnt know what to write here title: <>Works>, - description: ( - <> - Typegoose is compatible with almost every mongoose option - > - ), + description: <>Typegoose is compatible with almost every mongoose option>, }, ]; function Feature({ imageUrl, title, description }) { const imgUrl = useBaseUrl(imageUrl); + return (
{siteConfig.tagline}