dense-analysis / dense-analysis/ale
eslint lint file error with wrong path
- Dominant language
- Vim Script
- Stars
- 14k
- Forks
- 1.5k
- Avg merge
- 17h 49m
- Merged PRs (30d)
- 1
Description
## Information
**VIM version**
8.1.2269
Operating System: wsl Ubuntu 20.04.2
## What went wrong
I use eslint to lint ts/tsx file, but it gives me wrong message, such as
```ts
type LeaseResource = {
resourceId: string;
areaName: string;
resourceName: string;
actualArea: string | number;
chargeArea: string | number;
unitPrice: number;
unitName: string;
location: string;
};
```
that code has no bug, but ale gives me ```no-undef``` error with each line,
I check ale's code and find
```vim
" if !empty(a:cwd)
" let l:command = ale#command#CdString(a:cwd) . l:command
" endif
```
in function ale#command#FormatCommand.
I comment above code and eslint back to normal
## Reproducing the bug
when I open every every ts/tsx file.
### :ALEInfo
before I comment ```ale#command#CdString```
```
Current Filetype: typescript
Available Linters: ['deno', 'eslint', 'standard', 'tslint', 'tsserver', 'typecheck', 'xo']
Enabled Linters: ['eslint']
Ignored Linters: []
Suggested Fixers:
'deno' - Fix TypeScript using deno fmt.
'eslint' - Apply eslint --fix to a file.
'prettier' - Apply prettier to a file.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'tslint' - Fix typescript files with tslint --fix.
'xo' - Fix JavaScript/TypeScript files using xo --fix.
Linter Variables:
let g:ale_typescript_eslint_executable = 'eslint_d'
let g:ale_typescript_eslint_use_global = 1
Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 1
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'typescript': ['eslint'], 'javascript': ['eslint']}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - success) eslint_d
(finished - exit code 1) ['/usr/bin/zsh', '-c', 'cd ''/home/jq/projects/react/web-ms-admin/node_modules/.pnpm/registry.nlark.com+eslint@7.30.0'' && ''eslint_d'' -f json --stdin --stdin-filename ''/home/jq/projects/react/web-ms-admin/src/services/lease/contract.ts'' < ''/tmp/vLiujSm/1/contract.ts''']
<<>>
[{"filePath":"/home/jq/projects/react/web-ms-admin/src/services/lease/contract.ts","messages":[{"ruleId":"no-undef","severity":2,"message":"'LeaseResource' is not defined.","line":23,"column":13,"nodeType":"Identifier","messageId":"undef","endLine":23,"endColumn":26},{"ruleId":"no-undef","severity":2,"message":"'resourceId' is not defined.","line":24,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":24,"endColumn":13},{"ruleId":"no-undef","severity":2,"message":"'areaName' is not defined.","line":25,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":25,"endColumn":11},{"ruleId":"no-undef","severity":2,"message":"'resourceName' is not defined.","line":26,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":26,"endColumn":15},{"ruleId":"no-undef","severity":2,"message":"'actualArea' is not defined.","line":27,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":27,"endColumn":13},{"ruleId":"no-undef","severity":2,"message":"'chargeArea' is not defined.","line":28,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":28,"endColumn":13},{"ruleId":"no-undef","severity":2,"message":"'unitPrice' is not defined.","line":29,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":29,"endColumn":12},{"ruleId":"no-undef","severity":2,"message":"'unitName' is not defined.","line":30,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":30,"endColumn":11},{"ruleId":"no-restricted-globals","severity":2,"message":"Unexpected use of 'location'.","line":31,"column":3,"nodeType":"Identifier","messageId":"defaultMessage","endLine":31,"endColumn":11},{"ruleId":"no-undef","severity":2,"message":"'LeaseResource' is not defined.","line":41,"column":18,"nodeType":"Identifier","messageId":"undef","endLine":41,"endColumn":31},{"ruleId":"no-undef","severity":2,"message":"'LeaseResource' is not defined.","line":61,"column":18,"nodeType":"Identifier","messageId":"undef","endLine":61,"endColumn":31},{"ruleId":"no-undef","severity":2,"message":"'CostType' is not defined.","line":68,"column":13,"nodeType":"Identifier","messageId":"undef","endLine":68,"endColumn":21},{"ruleId":"no-undef","severity":2,"message":"'title' is not defined.","line":69,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":69,"endColumn":8},{"ruleId":"no-undef","severity":2,"message":"'nodeId' is not defined.","line":70,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":70,"endColumn":9},{"ruleId":"no-undef","severity":2,"message":"'parentId' is not defined.","line":71,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":71,"endColumn":11},{"ruleId":"no-undef","severity":2,"message":"'subjectCode' is not defined.","line":72,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":72,"endColumn":14},{"ruleId":"no-undef","severity":2,"message":"'subjectType' is not defined.","line":73,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":73,"endColumn":14},{"ruleId":"no-undef","severity":2,"message":"'bookDirection' is not defined.","line":74,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":74,"endColumn":16},{"ruleId":"no-undef","severity":2,"message":"'children' is not defined.","line":75,"column":3,"nodeType":"Identifier","messageId":"undef","endLine":75,"endColumn":11},{"ruleId":"no-undef","severity":2,"message":"'data' is not defined.","line":83,"column":5,"nodeType":"Identifier","messageId":"undef","endLine":83,"endColumn":9},{"ruleId":"no-undef","severity":2,"message":"'CostType' is not defined.","line":83,"column":18,"nodeType":"Identifier","messageId":"undef","endLine":83,"endColumn":26},{"ruleId":"no-undef","severity":2,"message":"'records' is not defined.","line":97,"column":5,"nodeType":"Identifier","messageId":"undef","endLine":97,"endColumn":12},{"ruleId":"no-restricted-globals","severity":2,"message":"Unexpected use of 'name'.","line":98,"column":7,"nodeType":"Identifier","messageId":"defaultMessage","endLine":98,"endColumn":11},{"ruleId":"no-undef","severity":2,"message":"'companyId' is not defined.","line":99,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":99,"endColumn":16},{"ruleId":"no-undef","severity":2,"message":"'records' is not defined.","line":112,"column":5,"nodeType":"Identifier","messageId":"undef","endLine":112,"endColumn":12},{"ruleId":"no-undef","severity":2,"message":"'id' is not defined.","line":113,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":113,"endColumn":9},{"ruleId":"no-undef","severity":2,"message":"'mobile' is not defined.","line":114,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":114,"endColumn":13},{"ruleId":"no-restricted-globals","severity":2,"message":"Unexpected use of 'name'.","line":115,"column":7,"nodeType":"Identifier","messageId":"defaultMessage","endLine":115,"endColumn":11},{"ruleId":"no-undef","severity":2,"message":"'records' is not defined.","line":129,"column":5,"nodeType":"Identifier","messageId":"undef","endLine":129,"endColumn":12},{"ruleId":"no-undef","severity":2,"message":"'empId' is not defined.","line":130,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":130,"endColumn":12},{"ruleId":"no-undef","severity":2,"message":"'realName' is not defined.","line":131,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":131,"endColumn":15},{"ruleId":"no-undef","severity":2,"message":"'companyName' is not defined.","line":132,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":132,"endColumn":18},{"ruleId":"no-undef","severity":2,"message":"'orgId' is not defined.","line":133,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":133,"endColumn":12},{"ruleId":"no-undef","severity":2,"message":"'orgName' is not defined.","line":134,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":134,"endColumn":14},{"ruleId":"no-undef","severity":2,"message":"'roleName' is not defined.","line":135,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":135,"endColumn":15},{"ruleId":"no-restricted-globals","severity":2,"message":"Unexpected use of 'status'.","line":136,"column":7,"nodeType":"Identifier","messageId":"defaultMessage","endLine":136,"endColumn":13},{"ruleId":"no-undef","severity":2,"message":"'records' is not defined.","line":150,"column":5,"nodeType":"Identifier","messageId":"undef","endLine":150,"endColumn":12},{"ruleId":"no-undef","severity":2,"message":"'id' is not defined.","line":151,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":151,"endColumn":9},{"ruleId":"no-undef","severity":2,"message":"'accountName' is not defined.","line":152,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":152,"endColumn":18},{"ruleId":"no-undef","severity":2,"message":"'address' is not defined.","line":153,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":153,"endColumn":14},{"ruleId":"no-undef","severity":2,"message":"'bank' is not defined.","line":154,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":154,"endColumn":11},{"ruleId":"no-undef","severity":2,"message":"'bankNo' is not defined.","line":155,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":155,"endColumn":13},{"ruleId":"no-undef","severity":2,"message":"'bodyId' is not defined.","line":156,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":156,"endColumn":13},{"ruleId":"no-undef","severity":2,"message":"'cardImg' is not defined.","line":157,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":157,"endColumn":14},{"ruleId":"no-undef","severity":2,"message":"'projectName' is not defined.","line":158,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":158,"endColumn":18},{"ruleId":"no-undef","severity":2,"message":"'taxpayerCode' is not defined.","line":159,"column":7,"nodeType":"Identifier","messageId":"undef","endLine":159,"endColumn":19}],"errorCount":46,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":"import { request } from 'umi';\n\n// 获取合同模板\n// @param {\n// projectId: string, // 项目id\n// status: 0\n// } data description\n// @return {Array} 模板列表\nexport function getContractTemplates(data: { projectId: string; status: 0 }) {\n return request('/leaseManage/temp/queryTempList', {\n method: 'post',\n data,\n });\n}\n\n// 获取合同编号和自定义关键字\nexport function getContractNoByTemplateId(templateId: string) {\n return request(`/leaseManage/temp/queryContractNo/${templateId}`, {\n method: 'get',\n });\n}\n\nexport type LeaseResource = {\n resourceId: string;\n areaName: string; // 所属区域\n resourceName: string;\n actualArea: string | number; // 面积\n chargeArea: string | number; // 计费面积\n unitPrice: number; // 单价\n unitName: string; // 单位\n location: string; // 位置\n};\n\n// 获取资源\n// @param {\n// projectId,\n// enable: 0\n// } name description\nexport function getResource(data: { projectId: string; enable: 0 }) {\n return request<{\n data: null | LeaseResource[];\n }>('/leaseLedger/resourceValuation/getResourceValuationManageList', {\n method: 'post',\n data,\n });\n}\n\n// @ApiModelProperty(value = \"租售状态 0:待租 1:已租 2:待售 3:已售\")\n// private String leaseSaleStatus;\n// @Valid\n// @NotNull\n// @ApiModelProperty(value = \"定价类型 0:出租 1:出售\")\n// private String valuationType;\nexport function queryValuationResourceList(data: {\n projectId: string;\n leaseSaleStatus: 0;\n valuationType: 0;\n enable: 0;\n}) {\n return request<{\n data: null | LeaseResource[];\n }>('/leaseLedger/resourceValuation/queryList', {\n method: 'post',\n data,\n });\n}\n\nexport type CostType = {\n title: string; // 科目名称,\n nodeId: string; // id,\n parentId: string; // 上级科目id,\n subjectCode: string; // 科目编码,\n subjectType: string; // 科目类型,\n bookDirection: string; // 记账方向,\n children: string; // []\n};\n\n/*\n * 查询费用类型\n */\nexport function getCostType(keyword: string = '') {\n return request<{\n data: null | CostType[];\n }>('/cfg/finance/getSubjectTree', {\n method: 'post',\n data: {\n keyword,\n },\n });\n}\n\n/**\n * 获取甲方列表\n */\nexport function getCfgCompanyPageList() {\n return request<{\n records: {\n name: string; // 公司名称\n companyId: string; // 公司id\n }[];\n }>('/cfg/finance/getGlobalCfgCompanyMainBodyPageList', {\n method: 'post',\n data: { current: 0, pageSize: 1000 },\n });\n}\n\n/**\n * 获取客户列表\n */\nexport function getCustomerArchieve() {\n return request<{\n records: {\n id: string; // 客户id,\n mobile: string; // 手机号码,\n name: string; // 客户名称,\n }[];\n }>('/crm/customerArchive/getCustomerArchivePageList', {\n method: 'post',\n data: { current: 0, pageSize: 1000 },\n });\n}\n\n/**\n * 获取甲方公司列表\n * @param {string} companyId 公司id\n */\nexport function getEmployeeList(companyId: any) {\n return request<{\n records: {\n empId: string; // \"2000710000\",\n realName: string; // \"员工姓名\",\n companyName: string; // \"公司\",\n orgId: string; // \"部门id\",\n orgName: string; // \"部门\",\n roleName: string; // \"岗位\",\n status: string; // \"状态 0有效 1失效\",\n }[];\n }>('/ubs/employee/getEmployeePageList', {\n method: 'post',\n data: { current: 0, pageSize: 1000, companyId },\n });\n}\n\n/**\n * 查询收款公司列表\n * @param {string} companyId 公司id\n */\nexport function getCfgAccountList(companyId: any) {\n return request<{\n records: {\n id: string; // \"id\",\n accountName: string; // \"帐户名\",\n address: string; // \"地址\",\n bank: string; // \"开户行\",\n bankNo: string; // \"帐号\",\n bodyId: string; // \"主体id\",\n cardImg: string; // \"开票名片\",\n projectName: string; // \"适用项目\",\n taxpayerCode: string; // \"纳税人识别码\"\n }[];\n }>('/cfg/finance/getGlobalCfgAccountPageList', {\n method: 'post',\n data: { current: 0, pageSize: 1000, companyId },\n });\n}\n\n/**\n * 提交合同\n * @params {ContractBaseRequest} params\n */\nexport function submitContract(params: any ) {\n return request('', {\n method: 'post',\n data: params\n })\n}\n\n\n/**\n * 生成应收计划 \n */\nexport function generateReceivablePlan(data: any ) {\n return request('/leaseManage/contractBase/generateReceivablePlan', {\n method: 'post',\n data\n })\n}\n","usedDeprecatedRules":[{"ruleId":"lines-around-directive","replacedBy":["padding-line-between-statements"]},{"ruleId":"global-require","replacedBy":[]},{"ruleId":"no-buffer-constructor","replacedBy":[]},{"ruleId":"no-new-require","replacedBy":[]},{"ruleId":"no-path-concat","replacedBy":[]}]}]
<<>>
```
after I comment:
```
Current Filetype: typescript
Available Linters: ['deno', 'eslint', 'standard', 'tslint', 'tsserver', 'typecheck', 'xo']
Enabled Linters: ['eslint']
Ignored Linters: []
Suggested Fixers:
'deno' - Fix TypeScript using deno fmt.
'eslint' - Apply eslint --fix to a file.
'prettier' - Apply prettier to a file.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'tslint' - Fix typescript files with tslint --fix.
'xo' - Fix JavaScript/TypeScript files using xo --fix.
Linter Variables:
let g:ale_typescript_eslint_executable = 'eslint_d'
let g:ale_typescript_eslint_use_global = 1
Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 1
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'typescript': ['eslint'], 'javascript': ['eslint']}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - success) eslint_d
(finished - exit code 0) ['/usr/bin/zsh', '-c', '''eslint_d'' -f json --stdin --stdin-filename ''/home/jq/projects/react/web-ms-admin/src/services/lease/contract.ts'' < ''/tmp/vGibPCx/1/contract.ts''']
<<>>
[{"filePath":"/home/jq/projects/react/web-ms-admin/src/services/lease/contract.ts","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[{"ruleId":"lines-around-directive","replacedBy":["padding-line-between-statements"]},{"ruleId":"global-require","replacedBy":[]},{"ruleId":"no-buffer-constructor","replacedBy":[]},{"ruleId":"no-new-require","replacedBy":[]},{"ruleId":"no-path-concat","replacedBy":[]}]}]
<<>>
```
Contributor guide
Assessment
This issue has not been assessed yet.