(线断式)期望线突破为" LF",但发现了" CRLF". (Eslint)
我在运行棉绒测试时遇到了此错误,如何解决此错误: (linebreak-style) Expected linebreaks to be 'LF' but found 'CRLF'. (eslint) ps:也许会有所帮助:我正在使用Windows(Webstorm),并且该项目正在Debian中运行和调试. 解决方案 主要解决方案是默认情况下使用CRLF(例如我的WebStorm)Windows. 1)第一步是在WebStorm上更改默认编码: configuring-line-separators.html 2)并在状态栏上更改它 bar.html 保存它!和 OKAY No lint warnings. 其他解决方案 在您的终端或CMD提示 中运行此操作 git config core.autocrlf false git rm --cached -r . git reset --hard 注意 - 确保您没有
0 2023-12-06
编程技术问答社区
我怎样才能为 "破折号风格 "写一条ESLint规则,根据Windows或Unix而改变?
众所周知,窗口中使用的线路断开(新线路)通常是托架返回(CR),然后是线馈电(LF),即(CRLF),而Linux和Unix使用简单的线馈电(LF) 现在,就我而言,我的构建服务器使用支持Linux和Unix格式,因此,下面的规则在构建服务器上正常工作: linebreak-style: ["error", "unix"] 但是我在Windows上进行开发,我需要在下面更新每个 git拉/git push 的规则, linebreak-style: ["error", "windows"] 那么,有什么方法可以编写通用线折叠风格以支持这两个环境,Linux/unix和Windows? 注意:我正在使用ecmascript6 [js],webstorm [ide]进行开发 任何解决方案/建议都将不胜感激.谢谢! 解决方案 ESLINT配置文件可以是一个常规.js文件(即,不是JSON,而是带有逻辑的完整js)来导出配置对象. 这意味着您可
0 2023-12-05
编程技术问答社区
属性 'showSaveFilePicker' 不存在于类型 'Window & typeof globalThis';
const opts = { suggestedName: 'data', types: [ { description: 'NewCSV', accept: { 'text/csv': ['.csv'] }, }, ], }; const handle = await (window).showSaveFilePicker(opts); 现在我有类型错误属性'showevefilepicker'在type'window&typeof globalthis'上不存在,将类型作为 abor any 解决类型错误的问题. const handle = await (window).showSaveFilePicker(opts); ,但仍然会显示eslint误差 any键入值的不安全呼叫.因此,我知道的唯一解决方案是禁用文件的ESLINT.还有其
0 2023-12-04
编程技术问答社区
ESLint: 无法启动语言服务进程/HLS .ts扩展名的问题
重要:请参阅下面的更新编辑,其中提供重要信息 使用Angular时,我一直在WebStorm 2021.2.2(和其他最新版本)中显示此错误: eslint:无法启动语言服务过程 请参阅下面的屏幕截图 所有.TS文件报告类似的错误: eslint:无法从语言服务中获得 我试图通过创建一个新的角度项目来重现问题: ng new video-and-event-listeners-test --style=scss --routing=true cd video-and-event-listeners-test/ ng add @angular-eslint/schematics --skip-confirmation 最初一切正常,但后来返回了错误,我无法摆脱它.我在每个项目中都有此错误(我的项目都包含HLS文件 - 请参见下面的编辑). ng lint命令悬挂.当您运行代码检查时,WebStorm会失败.有什么想法要解决这个问题(不只是禁用E
0 2023-12-03
编程技术问答社区
柏树和cy在命令中未定义,但是一切都起作用
在将自定义命令键入commands.js>中时,Webstorm的linter说Cypress和cy均未定义,并且不提供任何IntelliSense. 两者都是在任何integration文件中都完美定义的. commands.js Cypress.Commands.add('command', () => { cy.get('div'); }); // ESLint: 'Cypress' is not defined.(no-undef) // ESLint: 'cy' is not defined.(no-undef) index.js import './commands.js' 此错误未出现在VSCODE中.而是将Cypress和cy定义为any. 不管有什么错误,测试都可以正常工作. 我该怎么做才能让林格在自己的文件中识别柏树? 解决方案 我找到了一些解决方案. 添加参考 将其放在每个文件测试脚本的顶部 //
2 2023-12-03
编程技术问答社区
在typescript文件上启用Eslint
在WebStorm Eslint设置上,有一个"额外的ESLINT选项"字段. 在此中,我添加了: --ext .ts 来自Eslint 解决方案 --ext允许使用自定义JavaScript扩展名,您不能通过将其他文件扩展传递到它来强制ESLINT为JAVASCRIPT以外的其他语言工作. 您可以尝试使用 typescript-eslint-parser 启用Eslint for Typescript-允许从打字稿代码构建一个可以传递给Eslint的语法树以进行覆盖. ,但我建议使用打字稿衬里检查打字稿代码.您可以尝试 tslint ,例如. 更新:自2017.1.3以来,WebStorm支持Eslint + Typescript-eslint-Parser;您只需要同时安装typescript插件和typescript-eslint-parser并相应地修改ESLINT配置: "parser": "typescript-eslint-parser
0 2023-12-03
编程技术问答社区
WebStorm 2018.1.4 + ESLint: TypeError: this.CliEngine is not a constructor
我的配置是这个. WebStorm 2018.1.4; Eslint 6.4;节点12.8; NPM 6.10.2; Windows 8.1. 如何消除线程标题中的错误? 这是一个代码样本. import { GET_DAILY_SUCCESS, GET_HOURLY_SUCCESS, GET_MINUTE_SUCCESS } from './types'; import { getDailyToUsd, getHourlyToUsd, getMinuteToUsd } from '../api/cryptocompare'; import { setError } from './error'; export const getDaily = (fsym = 'BTC') => async dispatch => { try { const list = await getDailyToUsd(fsym); dis
0 2023-12-03
编程技术问答社区
如何在WebStorm/PHPStorm中配置ESLint保存时自动修复?
我正在尝试在WebStorm中创建一个自定义的文件观察器,该文件将自动修复保存上的ESLINT错误.在Settings > Tools > File Watchers中,我创建了一个具有以下设置的新文件观察器: 文件类型:Any 范围:All places 程序:/home/user/Projects/todo-app/eslint-autofix.sh 参数:空白 刷新的输出路径:空白 其他选项>工作目录:/home/user/Projects/todo-app eslint-autofix.sh: #!/usr/bin/env bash ./node_modules/.bin/eslint --fix 然后我犯了一个ESLINT错误,并按下 ctrl + s 保存.以下错误弹出: /home/user/Projects/todo-app/eslint-autofix.sh /usr/bin/env: ‘node’: No such file o
0 2023-12-03
编程技术问答社区
如何让WebStorm按照eslint的格式化代码?
我已经为我的WebStorm项目指定了ESLINT配置.但这似乎不适用于代码重新格式功能.例如,它继续格式化import { something } from 'somewhere'为import {something} from 'somewhere'. 是否有一种方法可以根据ESLINT配置使WebStorm格式化代码? 解决方案 在2021年为我解决了: Webstorm使用 Prettier 包装,有一个选择: Preferences | Languages & Frameworks | JavaScript | Prettier - > On 'Reformat Code' action 现在WebStorm使用eslint规则来重新格式化Reformat Code hotkey上的代码. 其他解决方案 (描述的步骤和屏幕截图来自 Intellij Idea 2017.2 ) 您可以将键盘快捷键添加到操作"修复ESLINT问题"中.
0 2023-12-03
编程技术问答社区
忽略或防止ESLint错误破坏React项目的构建(create-react-project)。
我最近创建了一个使用create-react-project的项目. 问题是,在我开发的同时,每当ESLINT出现问题时,构建都会破裂并且不会编译代码. 我可以在仍在运行ESLINT的同时保持构建运行,并报告以后会解决的错误? 解决方案 如果要强迫Eslint始终发出警告(不会阻止您构建)而不是错误,则需要设置emitWarning: true: { enforce: 'pre', include: paths.appSrc, test: /\.(js|jsx|mjs)$/, use: [{ loader: require.resolve('eslint-loader'), options: { formatter: eslintFormatter, eslintPath: require.resolve('eslint'),
0 2023-12-01
编程技术问答社区
Encore, Vue, Eslint-使用最新的vue-eslint-parser
大家好,我对Vue-Eslint-Parser有问题.我正在尝试在Encore 上运行它 /var/app/assets/js/app.js 1:1错误使用最新的vue-eslint-parser.另请参见 https://github.com/vuejs/eslint-plugin-vue#what-is-the-the-the-latest-vue-eslint-parser-error- 1:1错误使用最新的vue-eslint-parser.另请参见 https://github.com/vuejs/eslint-plugin-vue#what-is-the-the-the-latest-vue-eslint-parser-error- 1:1错误使用最新的vue-eslint-parser.另请参见 https://github.com/vuejs/eslint-plugin-vue#what-is-the-the-the-latest-vue-eslint-parser-
0 2023-12-01
编程技术问答社区
使用ESLint与Airbnb风格和标签(React.js)。
我正在研究react.js应用程序,我正在尝试提起我的代码.我将Eslint与Airbnb风格一起使用,但是我有这些错误: ../src/Test.jsx 4:2 error Unexpected tab character no-tabs 5:2 error Unexpected tab character no-tabs 5:3 error Expected indentation of 2 space characters but found 0 react/jsx-indent 6:2 error Unexpected tab character no-tabs 在这里我的代码: test.jsx: import React from
0 2023-12-01
编程技术问答社区
./types的大小写与底层文件系统不一致
所以我有一些奇怪的警告 './type'是一个流类型文件. 我认为Eslint将复选框读为小写,而实际上是复选框(Capital C). 我尝试git mv casesensitive tmp && git mv tmp CaseSensitive如下所述:>在GIT存储库中,如何正确重命名目录?,但它仍然不起作用. 因为过去该文件夹是小写的(复选框),并将其重命名为大写(复选框),但这是其他开发人员的工作,我不知道他的机器中会发生什么,直到我的机器出现在我的机器中.也许(另一个假设)这是由于Webpack/babel的不良配置而发生的,我不确定. 解决方案 遇到了同样的问题,我所做的只是重新启动编辑器(VSCODE). 希望这也对您有效. 另外,尝试复制文件的内容,删除文件,创建新文件,粘贴您的内容并相应地导入 这种错误可能令人沮丧. 但是,如果事情不起作用,并且您没有任何线索,请尝试将其关闭,然后再次关闭 其他解决方案 我在我的情况下也有
0 2023-12-01
编程技术问答社区
babel-eslint不允许动态导入
我使用webpack 2,我想进行动态导入. Linter在动态导入(即import(...))上给出以下错误: [JS]声明或声明预期. (JSX属性)导入:true. 我有关注.eslintrc(摘录): { "parser": "babel-eslint", "parserOptions": { "allowImportExportEverywhere": true } } 安装以下: "eslint": "^3.16.1", "babel-eslint": "^7.2.3", "babel-plugin-dynamic-import-webpack": "^1.0.1", "babel-plugin-syntax-dynamic-import": "^6.18.0", babelrc配置: { "presets": [ "es2015", "react" ], "plugins":
2 2023-12-01
编程技术问答社区
编译create-react-app时出现构建错误
我是Reactjs的新手,AM开始学习它.我一直在尝试启动一个基本的Hello World程序,但在编译级别上失败了. 创建了一个使用Create-react-app Helly-World创建启动的Hello-Word程序,它为我提供了一个不错的文件夹结构,并带有大量文件. 在这里,您可以看到汇编错误 Failed to compile ./src/index.js Module build failed: Error: Failed to load plugin import: Cannot find module 'eslint-plugin-import' Referenced from: at Array.forEach (native) at Array.reduceRight (native) This error occurred during the build time and cannot be dismissed. 在这里,错误状态找不到模块,因此我
0 2023-12-01
编程技术问答社区
webpack中的eslint导入。无法解决模块的路径问题
使用Eslint-import-resolver-webpack,我试图让Eslint知道我想通过引用"快捷方式"来导入文件(例如,组件/计数). 在下面的示例中,webpack(v2.2.0-rc.3)构建良好,但是测试失败了,因为它"无法解析模块'组件/计数器'的路径". 我还会出现此错误,以导入"组件/计数器/还原器",因此不限于索引. 运行npm run lint和我的IDE(Intellij)给出相同的错误. 遵循文档,我设置了以下配置: (一部分)文件结构: project-root/ app/ components/ Counter/ index.js reducer.js app.js internals/ config/ .eslintrc webpack.test.js package.json 文件:project-root/app
2 2023-12-01
编程技术问答社区
如何在ESLint中支持ES7
我有一个带有WebPack的项目设置用于使用ESLINT,我想将ES7用于Inline Bind Bind Operator ::.目前,我在下面显示的解析错误 /Users/ryanvice/Documents/Code/pluralsight-redux-starter/src/components/project/ProjectsPage.js (1/0) ✖ 7:27 Parsing error: Unexpected token : /Users/ryanvice/Documents/Code/pluralsight-redux-starter/src/routes.js (2/2) ✖ 6:26 Parse errors in imported module './components/project/ProjectsPage': Unexpected token : (7:27) import/namespace ✖ 6:26 Parse
0 2023-12-01
编程技术问答社区
Eslint抛出的东西被分配了一个值,但从未使用过 , webpack模块
我正在WebPack中导入脚本,这一切都可以,但是Eslint抛出了错误'modal is assigned a value but never used'.是否必须将const声明为全局或导出模块以解决错误? 模块.Vanillamodal.js: import VanillaModal from 'vanilla-modal'; // Create instance const modal = new VanillaModal({ modal: '.c-modal', modalInner: '.js-modal__inner', modalContent: '.js-modal__content', open: '[rel="js-modal:open"]', close: '[rel="js-modal:close"]', class: 'js-modal--visible', loadClass: 'js-modal--loaded',
2 2023-12-01
编程技术问答社区
ESLint不是一个构造函数
我已将移植到Eslint-webpack-plugin,并且我遇到了错误" Eslint不是构造函数",相关的snippet代码是: const ESLintPlugin = require('eslint-webpack-plugin'); const plugins = [ new webpack.DefinePlugin(productionEnvironmentVariables), new ESLintPlugin({ overrideConfigFile: path.resolve(configPath, '.eslintrc.json') }) ]; 任何想法怎么了?我也尝试使用新的eslintplugin()和eslintplugin({}). WebPack版本是 ^4.44.2 Eslint版本为 ^6.8.0 eslint-webpack-plugin是 ^2.1.0 提前感谢您. 解决方案
0 2023-12-01
编程技术问答社区
Eslint errorring导入jsx而不扩展
我在ES6中尝试导入JSX文件,而无需.jsx扩展名: import LoginErrorDialog from './LoginErrorDialogView'; 不是: import LoginErrorDialog from './LoginErrorDialogView.jsx'; 当我成功地以这种方式导入WebPack时: export default { entry: './src/ui/js/app.js', output: { publicPath: '/', filename: 'bundle.js' }, resolve: { extensions: ['.js', '.jsx'], eslint(esw webpack.config.* ./ --color --ext .js --ext .jsx)仍然是错误的. Unable to resolve path to module './Lo
10 2023-12-01
编程技术问答社区