├── .eslintrc.json ├── .github └── workflows │ └── main.yml ├── .gitignore ├── .prettierrc ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── __tests__ ├── Nl2br.spec.ts └── types │ └── wrapper.ts ├── jest.config.ts ├── package.json ├── renovate.json ├── src ├── Nl2br.ts └── index.ts ├── tsconfig.json └── yarn.lock /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es6": true, 4 | "browser": true 5 | }, 6 | "extends": [ 7 | "eslint:recommended", 8 | "plugin:@typescript-eslint/eslint-recommended", 9 | "plugin:@typescript-eslint/recommended", 10 | "plugin:prettier/recommended" 11 | ], 12 | "plugins": ["@typescript-eslint"], 13 | "parser": "@typescript-eslint/parser", 14 | "rules": { 15 | "@typescript-eslint/no-explicit-any": "off" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: [main] 5 | pull_request: 6 | branches: [main] 7 | 8 | # Allows you to run this workflow manually from the Actions tab 9 | workflow_dispatch: 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | with: 16 | # We need to fetch with a depth of 2 for pull_request so we can do HEAD^2 17 | fetch-depth: 2 18 | 19 | - uses: actions/setup-node@v4 20 | with: 21 | node-version: '18' 22 | 23 | - name: Setup 24 | run: yarn install 25 | 26 | - name: Lint 27 | run: yarn lint 28 | 29 | - name: Test 30 | run: yarn test 31 | 32 | - name: Build 33 | run: yarn build 34 | 35 | - name: '[Pull Request] Get commit message' 36 | if: always() && github.event_name == 'pull_request' 37 | id: pr_get_commit_message 38 | run: echo ::set-output name=pr_commit_message::$(git log --format=%B -n 1 HEAD^2) 39 | 40 | - name: Slack Notification 41 | if: always() 42 | uses: rtCamp/action-slack-notify@v2 43 | env: 44 | SLACK_MESSAGE: ${{ steps.pr_get_commit_message.outputs.pr_commit_message }} 45 | SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} 46 | SLACK_COLOR: ${{ job.status == 'success' && 'good' || 'danger' }} 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.1.1](https://github.com/inouetakuya/vue-nl2br/compare/v1.1.0...v1.1.1) (2022-06-11) 4 | 5 | ### Bug Fixes 6 | 7 | - Not built when v1.1.0 was released 8 | 9 | ## [1.1.0](https://github.com/inouetakuya/vue-nl2br/compare/v1.0.0...v1.1.0) (2022-06-11) 10 | 11 | ### Features 12 | 13 | - Allow null text ([#63](https://github.com/inouetakuya/vue-nl2br/issues/63)) ([0065659](https://github.com/inouetakuya/vue-nl2br/commit/0065659f3a9cdfa485ce744a2f42e9d4f510a20c)) 14 | 15 | ## [1.0.0](https://github.com/inouetakuya/vue-nl2br/compare/v0.2.0...v1.0.0) (2022-06-10) 16 | 17 | - [Build with TypeScript #45](https://github.com/inouetakuya/vue-nl2br/pull/45) 18 | 19 | And many improvements: 20 | 21 | - [Prettier and ESLint #46](https://github.com/inouetakuya/vue-nl2br/pull/46) 22 | - [CI #48](https://github.com/inouetakuya/vue-nl2br/pull/48) 23 | - [Add tests #58](https://github.com/inouetakuya/vue-nl2br/pull/58) 24 | - [Improve types #60](https://github.com/inouetakuya/vue-nl2br/pull/60) 25 | 26 | ## [0.2.0](https://github.com/inouetakuya/vue-nl2br/compare/v0.1.2...v0.2.0) (2022-06-01) 27 | 28 | ### Bug Fixes 29 | 30 | - [Security vulnerabilities #44](https://github.com/inouetakuya/vue-nl2br/pull/44) 31 | 32 | ### Chores 33 | 34 | - Bump many dependencies 35 | 36 | ## [0.1.2](https://github.com/inouetakuya/vue-nl2br/compare/v0.1.1...v0.1.2) (2019-07-20) 37 | 38 | ### Bug Fixes 39 | 40 | - Rebuild after adding className property 41 | - [Security vulnerabilities #20](https://github.com/inouetakuya/vue-nl2br/pull/20) 42 | - Bump webpack to v4 43 | 44 | ### Chores 45 | 46 | - Bump many dependencies 47 | 48 | ## [0.1.1](https://github.com/inouetakuya/vue-nl2br/compare/v0.1.0...v0.1.1) (2019-01-03) 49 | 50 | ### Features 51 | 52 | - [Add className to props #9](https://github.com/inouetakuya/vue-nl2br/pull/9) 53 | 54 | ### Chores 55 | 56 | - [Write MIT License file #10](https://github.com/inouetakuya/vue-nl2br/pull/10) 57 | - [Write CHANGELOG #11](https://github.com/inouetakuya/vue-nl2br/pull/11) 58 | 59 | ## [0.1.0](https://github.com/inouetakuya/vue-nl2br/compare/v0.0.5...v0.1.0) (2019-01-03) 60 | 61 | ### Chores 62 | 63 | - [Move vue to peerDependencies #8](https://github.com/inouetakuya/vue-nl2br/pull/8) 64 | 65 | ## [0.0.5](https://github.com/inouetakuya/vue-nl2br/compare/v0.0.4...v0.0.5) (2017-06-04) 66 | 67 | ### Braking Changes 68 | 69 | - Renamed property: `content` -> `text` 70 | 71 | ## [0.0.4](https://github.com/inouetakuya/vue-nl2br/compare/v0.0.3...v0.0.4) (2017-06-04) 72 | 73 | ### Chores 74 | 75 | - [Write props in readme #3](https://github.com/inouetakuya/vue-nl2br/pull/3) 76 | 77 | ## [0.0.3](https://github.com/inouetakuya/vue-nl2br/compare/v0.0.2...v0.0.3) (2017-06-04) 78 | 79 | ### Bug Fixes 80 | 81 | - [Unexpected token punc «(», expected punc «:» error from UglifyJs #2](https://github.com/inouetakuya/vue-nl2br/pull/2) 82 | 83 | ## 0.0.2 (2017-06-04) 84 | 85 | ### Features 86 | 87 | - [Enable build with webpack #1](https://github.com/inouetakuya/vue-nl2br/pull/1) 88 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 INOUE Takuya ([@inouetakuya](https://github.com/inouetakuya)) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-nl2br 2 | 3 | ![main workflow](https://github.com/inouetakuya/vue-nl2br/actions/workflows/main.yml/badge.svg) 4 | 5 | A vue component which turns new lines into line breaks. 6 | 7 | ## Why not just use CSS? 8 | 9 | See [Why not just use CSS `white-space: pre;`? · Issue #7](https://github.com/inouetakuya/vue-nl2br/issues/7) 10 | 11 | ## Requirement 12 | 13 | - [Vue.js](https://github.com/vuejs/vue) `^2.0.0` 14 | 15 | ## Installation 16 | 17 | ```shell 18 | npm install --save vue-nl2br 19 | ``` 20 | 21 | ## Usage 22 | 23 | ```html 24 | 25 | ``` 26 | 27 | is rendered to 28 | 29 | ```html 30 |

myLine1
myLine2

31 | ``` 32 | 33 | ### (1) Global registration 34 | 35 | https://vuejs.org/v2/guide/components.html#Registration 36 | 37 | ```js 38 | import Vue from 'vue' 39 | import Nl2br from 'vue-nl2br' 40 | 41 | Vue.component('nl2br', Nl2br) 42 | ``` 43 | 44 | ### (2) Local registration 45 | 46 | https://vuejs.org/v2/guide/components.html#Local-Registration 47 | 48 | ```vue 49 | // MyComponent.vue 50 | 51 | 54 | 55 | 66 | ``` 67 | 68 | ## Props 69 | 70 | - `tag`: HTML tag name which is passed to [createElement function](https://vuejs.org/v2/guide/render-function.html#createElement-Arguments) 71 | - Type: `String` 72 | - Required: true 73 | - `text`: Text in the tag. 74 | - Type: `String` 75 | - Default: null 76 | - `className`: HTML class name(s) 77 | - Type: `String` 78 | - Required: false 79 | 80 | Note: when `text` property is empty or null, it renders an empty tag. ex) `

`. 81 | 82 | If you prefer to render nothing at all, use `v-if` directive: 83 | 84 | ```html 85 | 86 | ``` 87 | 88 | ## License 89 | 90 | [MIT](https://opensource.org/licenses/MIT) 91 | -------------------------------------------------------------------------------- /__tests__/Nl2br.spec.ts: -------------------------------------------------------------------------------- 1 | import { mount } from '@vue/test-utils' 2 | import Nl2br from '../src/Nl2br' 3 | import type { ExtendedWrapper } from './types/wrapper' 4 | 5 | const factoryWrapper = (props: { 6 | tag: string 7 | text: string | null 8 | className?: string 9 | }): ExtendedWrapper => { 10 | return mount(Nl2br, { 11 | context: { 12 | props, 13 | }, 14 | }) 15 | } 16 | 17 | describe('Nl2br', () => { 18 | let wrapper: ExtendedWrapper 19 | 20 | beforeEach(() => { 21 | wrapper = factoryWrapper({ 22 | tag: 'p', 23 | text: 'myLine\nmyLine2', 24 | }) 25 | }) 26 | 27 | it('creates br elements', () => { 28 | expect(wrapper.html()).toBe('

myLine
myLine2

') 29 | }) 30 | 31 | describe('when text is empty', () => { 32 | beforeEach(() => { 33 | wrapper = factoryWrapper({ tag: 'p', text: '' }) 34 | }) 35 | 36 | it('creates empty p element', () => { 37 | expect(wrapper.html()).toBe('

') 38 | }) 39 | }) 40 | 41 | describe('when text is null', () => { 42 | beforeEach(() => { 43 | wrapper = factoryWrapper({ tag: 'p', text: null }) 44 | }) 45 | 46 | it('creates empty p element', () => { 47 | expect(wrapper.html()).toBe('

') 48 | }) 49 | }) 50 | 51 | describe('when className is set', () => { 52 | beforeEach(() => { 53 | wrapper = factoryWrapper({ 54 | tag: 'p', 55 | text: 'myLine\nmyLine2', 56 | className: 'foo bar', 57 | }) 58 | }) 59 | 60 | it('creates p element with class attribute', () => { 61 | expect(wrapper.html()).toBe('

myLine
myLine2

') 62 | }) 63 | }) 64 | }) 65 | -------------------------------------------------------------------------------- /__tests__/types/wrapper.ts: -------------------------------------------------------------------------------- 1 | import { Wrapper } from '@vue/test-utils' 2 | import Vue from 'vue' 3 | 4 | // https://github.com/vuejs/vue-test-utils/issues/255#issuecomment-628628682 5 | export type ExtendedWrapper> = Wrapper< 6 | Vue & { [key: string]: any } & T 7 | > 8 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * For a detailed explanation regarding each configuration property and type check, visit: 3 | * https://jestjs.io/docs/configuration 4 | */ 5 | 6 | export default { 7 | // All imported modules in your tests should be mocked automatically 8 | // automock: false, 9 | 10 | // Stop running tests after `n` failures 11 | // bail: 0, 12 | 13 | // The directory where Jest should store its cached dependency information 14 | // cacheDirectory: "/private/var/folders/8z/tv6hcmw50jz4kbgy6tz6pfbw0000gn/T/jest_dx", 15 | 16 | // Automatically clear mock calls, instances, contexts and results before every test 17 | // clearMocks: false, 18 | 19 | // Indicates whether the coverage information should be collected while executing the test 20 | // collectCoverage: false, 21 | 22 | // An array of glob patterns indicating a set of files for which coverage information should be collected 23 | // collectCoverageFrom: undefined, 24 | 25 | // The directory where Jest should output its coverage files 26 | // coverageDirectory: undefined, 27 | 28 | // An array of regexp pattern strings used to skip coverage collection 29 | // coveragePathIgnorePatterns: [ 30 | // "/node_modules/" 31 | // ], 32 | 33 | // Indicates which provider should be used to instrument code for coverage 34 | coverageProvider: 'v8', 35 | 36 | // A list of reporter names that Jest uses when writing coverage reports 37 | // coverageReporters: [ 38 | // "json", 39 | // "text", 40 | // "lcov", 41 | // "clover" 42 | // ], 43 | 44 | // An object that configures minimum threshold enforcement for coverage results 45 | // coverageThreshold: undefined, 46 | 47 | // A path to a custom dependency extractor 48 | // dependencyExtractor: undefined, 49 | 50 | // Make calling deprecated APIs throw helpful error messages 51 | // errorOnDeprecated: false, 52 | 53 | // The default configuration for fake timers 54 | // fakeTimers: { 55 | // "enableGlobally": false 56 | // }, 57 | 58 | // Force coverage collection from ignored files using an array of glob patterns 59 | // forceCoverageMatch: [], 60 | 61 | // A path to a module which exports an async function that is triggered once before all test suites 62 | // globalSetup: undefined, 63 | 64 | // A path to a module which exports an async function that is triggered once after all test suites 65 | // globalTeardown: undefined, 66 | 67 | // A set of global variables that need to be available in all test environments 68 | // globals: {}, 69 | 70 | // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. 71 | // maxWorkers: "50%", 72 | 73 | // An array of directory names to be searched recursively up from the requiring module's location 74 | // moduleDirectories: [ 75 | // "node_modules" 76 | // ], 77 | 78 | // An array of file extensions your modules use 79 | // moduleFileExtensions: [ 80 | // "js", 81 | // "mjs", 82 | // "cjs", 83 | // "jsx", 84 | // "ts", 85 | // "tsx", 86 | // "json", 87 | // "node" 88 | // ], 89 | 90 | // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module 91 | // moduleNameMapper: {}, 92 | 93 | // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader 94 | // modulePathIgnorePatterns: [], 95 | 96 | // Activates notifications for test results 97 | // notify: false, 98 | 99 | // An enum that specifies notification mode. Requires { notify: true } 100 | // notifyMode: "failure-change", 101 | 102 | // A preset that is used as a base for Jest's configuration 103 | preset: 'ts-jest', 104 | 105 | // Run tests from one or more projects 106 | // projects: undefined, 107 | 108 | // Use this configuration option to add custom reporters to Jest 109 | // reporters: undefined, 110 | 111 | // Automatically reset mock state before every test 112 | // resetMocks: false, 113 | 114 | // Reset the module registry before running each individual test 115 | // resetModules: false, 116 | 117 | // A path to a custom resolver 118 | // resolver: undefined, 119 | 120 | // Automatically restore mock state and implementation before every test 121 | // restoreMocks: false, 122 | 123 | // The root directory that Jest should scan for tests and modules within 124 | // rootDir: undefined, 125 | 126 | // A list of paths to directories that Jest should use to search for files in 127 | // roots: [ 128 | // "" 129 | // ], 130 | 131 | // Allows you to use a custom runner instead of Jest's default test runner 132 | // runner: "jest-runner", 133 | 134 | // The paths to modules that run some code to configure or set up the testing environment before each test 135 | // setupFiles: [], 136 | 137 | // A list of paths to modules that run some code to configure or set up the testing framework before each test 138 | // setupFilesAfterEnv: [], 139 | 140 | // The number of seconds after which a test is considered as slow and reported as such in the results. 141 | // slowTestThreshold: 5, 142 | 143 | // A list of paths to snapshot serializer modules Jest should use for snapshot testing 144 | // snapshotSerializers: [], 145 | 146 | // The test environment that will be used for testing 147 | testEnvironment: 'jsdom', 148 | 149 | // Options that will be passed to the testEnvironment 150 | // testEnvironmentOptions: {}, 151 | 152 | // Adds a location field to test results 153 | // testLocationInResults: false, 154 | 155 | // The glob patterns Jest uses to detect test files 156 | // testMatch: [ 157 | // "**/__tests__/**/*.[jt]s?(x)", 158 | // "**/?(*.)+(spec|test).[tj]s?(x)" 159 | // ], 160 | testMatch: ['**/__tests__/**/*.(spec|test).[jt]s'], 161 | 162 | // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped 163 | // testPathIgnorePatterns: [ 164 | // "/node_modules/" 165 | // ], 166 | 167 | // The regexp pattern or array of patterns that Jest uses to detect test files 168 | // testRegex: [], 169 | 170 | // This option allows the use of a custom results processor 171 | // testResultsProcessor: undefined, 172 | 173 | // This option allows use of a custom test runner 174 | // testRunner: "jest-circus/runner", 175 | 176 | // A map from regular expressions to paths to transformers 177 | // transform: undefined, 178 | 179 | // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation 180 | // transformIgnorePatterns: [ 181 | // "/node_modules/", 182 | // "\\.pnp\\.[^\\/]+$" 183 | // ], 184 | 185 | // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them 186 | // unmockedModulePathPatterns: undefined, 187 | 188 | // Indicates whether each individual test should be reported during the run 189 | // verbose: undefined, 190 | 191 | // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode 192 | // watchPathIgnorePatterns: [], 193 | 194 | // Whether to use watchman for file crawling 195 | // watchman: true, 196 | } 197 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-nl2br", 3 | "version": "1.1.1", 4 | "description": "A vue component that turns new lines into line breaks.", 5 | "keywords": [ 6 | "vue", 7 | "nl2br" 8 | ], 9 | "author": "INOUE Takuya", 10 | "homepage": "https://github.com/inouetakuya/vue-nl2br#readme", 11 | "bugs": { 12 | "url": "https://github.com/inouetakuya/vue-nl2br/issues" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+ssh://git@github.com/inouetakuya/vue-nl2br.git" 17 | }, 18 | "license": "MIT", 19 | "publishConfig": { 20 | "registry": "https://registry.npmjs.org" 21 | }, 22 | "main": "dist/index.js", 23 | "types": "dist/index.d.ts", 24 | "files": [ 25 | "dist" 26 | ], 27 | "scripts": { 28 | "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts --ignore-path .gitignore .", 29 | "lint:fix": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts --ignore-path .gitignore . --fix", 30 | "test": "jest", 31 | "build": "rm -rf dist/ && tsc", 32 | "version": "conventional-changelog --preset angular --infile CHANGELOG.md --same-file && git add CHANGELOG.md" 33 | }, 34 | "peerDependencies": { 35 | "vue": "^2.0.0" 36 | }, 37 | "devDependencies": { 38 | "@types/jest": "29.5.14", 39 | "@typescript-eslint/eslint-plugin": "8.23.0", 40 | "@typescript-eslint/parser": "8.23.0", 41 | "@vue/test-utils": "1.3.6", 42 | "conventional-changelog-cli": "5.0.0", 43 | "eslint": "9.26.0", 44 | "eslint-config-prettier": "10.1.5", 45 | "eslint-plugin-prettier": "5.2.6", 46 | "jest": "29.7.0", 47 | "jest-environment-jsdom": "29.7.0", 48 | "prettier": "3.5.3", 49 | "ts-jest": "29.3.4", 50 | "ts-node": "10.9.2", 51 | "typescript": "5.7.3", 52 | "vue": "2.7.16", 53 | "vue-template-compiler": "2.7.16" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:base", ":timezone(Asia/Tokyo)"], 4 | "schedule": ["after 5am and before 8am on saturday"] 5 | } 6 | -------------------------------------------------------------------------------- /src/Nl2br.ts: -------------------------------------------------------------------------------- 1 | import type { CreateElement, RenderContext, VNode } from 'vue' 2 | 3 | type Props = { 4 | tag: string 5 | text: string | null 6 | className?: string 7 | } 8 | 9 | export default { 10 | functional: true, 11 | props: { 12 | tag: { 13 | type: String, 14 | required: true, 15 | }, 16 | text: { 17 | type: String, 18 | default: null, 19 | }, 20 | className: { 21 | type: String, 22 | required: false, 23 | }, 24 | }, 25 | render(createElement: CreateElement, context: RenderContext): VNode { 26 | const { tag, className } = context.props 27 | const text = context.props.text || '' 28 | 29 | return createElement( 30 | tag, 31 | { 32 | class: className, 33 | }, 34 | text 35 | .split('\n') 36 | .reduce((accumulator: (VNode | string)[], string: string) => { 37 | if (accumulator.length === 0) { 38 | return new Array(string) 39 | } 40 | return accumulator.concat([createElement('br'), string]) 41 | }, []), 42 | ) 43 | }, 44 | } 45 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import nl2br from './Nl2br' 2 | 3 | export default nl2br 4 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 26 | 27 | /* Modules */ 28 | "module": "umd", /* Specify what module code is generated. */ 29 | // "rootDir": "./", /* Specify the root folder within your source files. */ 30 | "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 31 | "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 38 | // "resolveJsonModule": true, /* Enable importing .json files. */ 39 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 40 | 41 | /* JavaScript Support */ 42 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 43 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 44 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 45 | 46 | /* Emit */ 47 | "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 48 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 49 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 50 | "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 51 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 52 | "outDir": "./dist", /* Specify an output folder for all emitted files. */ 53 | // "removeComments": true, /* Disable emitting comments. */ 54 | // "noEmit": true, /* Disable emitting files from a compilation. */ 55 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 56 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 57 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 58 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 59 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 60 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 61 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 62 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 63 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 64 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 65 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 66 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 67 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 68 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 69 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 70 | 71 | /* Interop Constraints */ 72 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 73 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 74 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 75 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 76 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 77 | 78 | /* Type Checking */ 79 | "strict": true, /* Enable all strict type-checking options. */ 80 | "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 81 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 82 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 83 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 84 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 85 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 86 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 87 | "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 88 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 89 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 90 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 91 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 92 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 93 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 94 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 95 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 96 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 97 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 98 | 99 | /* Completeness */ 100 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 101 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 102 | }, 103 | "include": [ 104 | "src/**/*" 105 | ] 106 | } 107 | --------------------------------------------------------------------------------