小编Fel*_*lHa的帖子

除非在“jsx”为“react-jsx”时提供了“--jsx”标志,否则无法使用 JSX

打字稿抛出:

除非提供了“--jsx”标志,否则无法使用 JSX。ts(17004)

更改tsconfig.json jsx为 后react-jsx,jsx 工作。yarn start将 tsconfig.jsonreact-jsx再次更改为。

react-scripts 已更新至 4.0.1。

包.json

"dependencies": {
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-scripts": "4.0.1",
    "semantic-ui-css": "^2.4.1",
  },
  "devDependencies": {
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.2.2",
    "@testing-library/user-event": "^12.1.10",
    "@types/jest": "^26.0.15",
    "@types/node": "^14.14.9",
    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",
    "@typescript-eslint/eslint-plugin": "^4.8.1",
    "@typescript-eslint/parser": "^4.8.1",
    "eslint-config-react": "^1.1.7",
    "eslint-plugin-react": "^7.21.5",
    "eslint-plugin-react-hooks": "^4.2.0",
    "typescript": "^4.1.2"
  },
Run Code Online (Sandbox Code Playgroud)

配置文件

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": …
Run Code Online (Sandbox Code Playgroud)

jsx typescript reactjs react-scripts

7
推荐指数
1
解决办法
2815
查看次数

如何在不扩大行高的情况下在段落的第一行生成一个首字母?

我想要一个段落的第一行的首字母和所有其他段落的文本缩进.我正在使用以下代码:

<xsl:template match="paragraph">
    <xsl:choose>
        <!-- no text-indent, first letter bigger -->
        <xsl:when test="fn:position() = 1">
            <fo:block font-size="10pt" font-height="12pt">
                <fo:inline font-size="18pt"><xsl:value-of 
                  select="substring(.,1,1)"/></fo:inline>
                <xsl:value-of select="substring(.,2)"/>
            </fo:block>
        </xsl:when>
        <xsl:otherwise>
            <!-- text-indent --> 
            <fo:block line-height="12pt"  
                text-indent="10pt">
                <xsl:value-of select="."/></fo:block>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)

这是有效的,但是第一行的行高被放大了,行之间有很大的空间. 在此输入图像描述

line-height-attributes或<fo:initial-property-set>不起作用.非常感谢.

编辑:我正在使用fop

编辑:FOP不支持<fo:float><fo:initial-property-set>.我尝试使用另一个代码<fo:list>:

        <xsl:when test="fn:position() = 1">
            <fo:block font-family="Times" font-size="10pt" line-height="12pt"> 
                <fo:list-block>
                    <fo:list-item>
                        <fo:list-item-label>
                            <fo:block font-size="18pt"><xsl:value-of select="substring(.,1,1)"/></fo:block>
                        </fo:list-item-label>
                        <fo:list-item-body>
                            <fo:block><xsl:value-of select="substring(.,2)"/></fo:block>
                        </fo:list-item-body>
                    </fo:list-item>
                </fo:list-block>
            </fo:block>
        </xsl:when>
Run Code Online (Sandbox Code Playgroud)

结果如下:

在此输入图像描述

所以我&#8199;在选择模式的值中使用了数字空间<fo:list-item-body>:

        <xsl:when test="fn:position() …
Run Code Online (Sandbox Code Playgroud)

pdf xslt xsl-fo apache-fop

5
推荐指数
1
解决办法
1064
查看次数

ESLint 与 Babel:在 .eslintrc 中未找到声明的插件提案类属性

ESLint 服务器抛出以下错误:

[信息 - 11:43:42] 无法加载在“.eslintrc.json”中声明的插件“@babel/plugin-proposal-class-properties”:找不到模块“@babel/eslint-plugin-plugin-proposal-class” -特性'

我安装了@babel/plugin-proposal-class-properties,但 ESLint 服务器尝试从路径加载它:'@babel/eslint-plugin-plugin-proposal-class-properties'而软件包安装在此处:'@babel/plugin-proposal-class-properties'

包.json:

{
  ...
  "dependencies": {},
  "devDependencies": {
    "@babel/core": "^7.12.3",
    "@babel/eslint-parser": "^7.12.1",
    "@babel/eslint-plugin": "^7.12.1",
    "@babel/plugin-proposal-class-properties": "^7.12.1",
    "eslint": "^7.11.0",
    "eslint-config-airbnb-base": "^14.2.0",
    "eslint-plugin-import": "^2.22.1"
  }
}
Run Code Online (Sandbox Code Playgroud)

.eslintrc.json

{
  "extends": ["airbnb-base"],
  "parser": "@babel/eslint-parser",
  "parserOptions": {
    "sourceType": "module",
    "allowImportExportEverywhere": false,
    "requireConfigFile": false
  },
  "plugins": ["@babel", "@babel/plugin-proposal-class-properties"],
  "rules": {
  }
}
Run Code Online (Sandbox Code Playgroud)

为什么 ESLint 尝试从错误的路径加载插件以及如何修复它?

javascript eslint babeljs

5
推荐指数
1
解决办法
2821
查看次数