profile
viewpoint
Pig Fang g-plane Honoka Tech LTD Kaiping, Guangdong, China https://gplane.win Student / Metro Fan / Minecraft / TypeScript / Rust

pull request commentbabel/babel

Disallow "let" as name at lexical bindings

@nicolo-ribaudo Are there anything else that should be changed?

g-plane

comment created time in 14 hours

push eventg-plane/babel

Pig Fang

commit sha 23ddcf007c7335b002686e4abbc3426a65b026e3

Clean up

view details

push time in 14 hours

push eventg-plane/babel

Pig Fang

commit sha e93c823933063016c42b3f1e4cf4fac9ff8df4b9

Simplify

view details

push time in 14 hours

Pull request review commentbabel/babel

Disallow "let" as name at lexical bindings

 export default class StatementParser extends ExpressionParser {       this.unexpected(null, "let is disallowed as a lexically bound name");

Sure!

g-plane

comment created time in 15 hours

push eventbs-community/blessing-skin-server

Pig Fang

commit sha 66182eaabc5920e0c1cd378113f951900196b246

Optimize panel of changing color

view details

push time in 17 hours

Pull request review commentbabel/babel

Disallow "let" as name at lexical bindings

 export default class StatementParser extends ExpressionParser {     );   } +  checkVarIdHasLet(id: ?N.Pattern): ?N.Identifier {

We need the identifier to report the error location.

g-plane

comment created time in 21 hours

push eventg-plane/blog

Pig Fang

commit sha c152beb455495578bfc507fec5fb27d8e36e4c0b

update about page

view details

push time in a day

push eventg-plane/blog

Pig Fang

commit sha 795a0c5791d57b11be448e73312394f4b603c191

update about page

view details

push time in a day

PR opened babel/babel

Disallow "let" as name at lexical bindings

<!-- Before making a PR, please read our contributing guidelines https://github.com/babel/babel/blob/master/CONTRIBUTING.md

For issue references: Add a comma-separated list of a closing word followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly)

If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website -->

Q A <!--(Can use an emoji 👍) -->
Fixed Issues?
Patch: Bug Fix? :+1:
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes? No
License MIT

<!-- Describe your changes below in as much detail as possible --> Spec: https://www.ecma-international.org/ecma-262/9.0/#sec-let-and-const-declarations-static-semantics-early-errors

+41 -0

0 comment

9 changed files

pr created time in a day

create barnchg-plane/babel

branch : disallow-binding-let

created branch time in a day

issue commenteslint/eslint

no-undef should apply on assigning a property to an undefined variable

I can't reproduce:https://eslint.org/demo/#eyJ0ZXh0IjoiVGV4dC5wcm9wVHlwZXMgPSB7IGE6ICdiJyB9Iiwib3B0aW9ucyI6eyJwYXJzZXJPcHRpb25zIjp7ImVjbWFWZXJzaW9uIjo5LCJzb3VyY2VUeXBlIjoibW9kdWxlIiwiZWNtYUZlYXR1cmVzIjp7fX0sInJ1bGVzIjp7Im5vLXVuZGVmIjoyfSwiZW52Ijp7fX19

hexagon6

comment created time in 2 days

issue commenteslint/eslint

newline-after-var rule is broken with babel-eslint >= 9

Hey @brokenmass , thanks for the issue.

This rule has been deprecated.

brokenmass

comment created time in 2 days

fork g-plane/babel

🐠 Babel is a compiler for writing next generation JavaScript.

https://babeljs.io/

fork in 2 days

pull request commenteslint/eslint

Upgrade: @babel/polyfill => core-js v3

@platinumazure We can run npm run webpack to generate the bundle.

aladdin-add

comment created time in 2 days

push eventg-plane/blog

Pig Fang

commit sha 9b1c15ea9a070a69605d73880de5fc9994791517

add feed plugin

view details

push time in 2 days

Pull request review commentulivz/awesome-vuepress

feat: add vuepress-theme-simple-blog

 - [vuepress-theme-macgs](https://github.com/EasyHexo/vuepress-theme-macgs) - :dizzy: A vuepress theme for [easyhexo.com](https://easyhexo.com) - [vuepress-theme-jupiter](https://github.com/zlliang/vuepress-theme-jupiter) - A simple theme using [Bulma-jupiter](https://github.com/zlliang/bulma-jupiter) styles, and supporting LaTeX rendering - [vuepress-theme-simple](https://github.com/viko16/vuepress-theme-simple) - ✏️ Very Simple Blog Theme for VuePress+- [vuepress-theme-simple-blog](https://github.com/g-plane/vuepress-theme-simple-blog) - Forked from "vuepress-theme-simple", but provides better support for [@vuepress/plugin-blog](https://github.com/ulivz/vuepress-plugin-blog).

You can compare the code if you want.

g-plane

comment created time in 2 days

push eventg-plane/awesome-vuepress

Pig Fang

commit sha 3bc50fce81ca00ca79a3b5eb77d1a19ffd43a94c

feat: add vuepress-theme-simple-blog

view details

push time in 2 days

fork g-plane/awesome-vuepress

🎉 A curated list of awesome things related to VuePress

fork in 2 days

push eventg-plane/blog

Pig Fang

commit sha 9313462904804991d6a316d8a13cbb0532f41855

tweak

view details

push time in 3 days

push eventg-plane/blog

Pig Fang

commit sha 116b823c8401dff6bf26964611fac7edd4f0add7

move to external theme

view details

push time in 3 days

created tagg-plane/vuepress-theme-simple-blog

tagv0.1.2

Forked from "vuepress-theme-simple", but provides better support for @vuepress/plugin-blog.

created time in 3 days

push eventg-plane/vuepress-theme-simple-blog

Pig Fang

commit sha 7e6761a7b261d046f35a46dcabe3c7d135f9422d

fix entry

view details

Pig Fang

commit sha 86fc9a0b406ada66513fb47c6b2676fc81fcec9b

v0.1.2

view details

push time in 3 days

created tagg-plane/vuepress-theme-simple-blog

tagv0.1.1

Forked from "vuepress-theme-simple", but provides better support for @vuepress/plugin-blog.

created time in 3 days

push eventg-plane/vuepress-theme-simple-blog

Pig Fang

commit sha 1d04f3334baff80c4c4e0827fef44473a26dcb00

fix entry

view details

Pig Fang

commit sha 4ed53865a0e3579222ab3fcfd9925cc850ea17fe

v0.1.1

view details

push time in 3 days

push eventg-plane/vuepress-theme-simple-blog

Pig Fang

commit sha badfae026b7fcad2e488eca89ac714dd6f7cb282

v0.1.0

view details

push time in 3 days

created tagg-plane/vuepress-theme-simple-blog

tagv0.1.0

Forked from "vuepress-theme-simple", but provides better support for @vuepress/plugin-blog.

created time in 3 days

push eventg-plane/vuepress-theme-simple-blog

Pig Fang

commit sha 9c8821841be0138af885874874e785b45f6813bf

update description

view details

Pig Fang

commit sha 1ba4bcb9e3437fffe78a33ee1fa98969d7dd60d5

update lockfile

view details

push time in 3 days

push eventg-plane/vuepress-theme-simple-blog

Pig Fang

commit sha 9b246d8bddb2819e584cdcd3eddebf7d07004a3a

add readme [skip ci]

view details

push time in 3 days

push eventg-plane/vuepress-theme-simple-blog

Pig Fang

commit sha c4dd774af436279fb589f59962e1c547d916dca7

Set up CI with Azure Pipelines [skip ci]

view details

push time in 3 days

push eventg-plane/vuepress-theme-simple-blog

Pig Fang

commit sha 708464668adf260193474fe905b92941fa357153

add more tests

view details

push time in 3 days

push eventg-plane/vuepress-theme-simple-blog

Pig Fang

commit sha fe5bfb3173f44501052906243e033d91de63fc09

add tests

view details

push time in 3 days

issue commenteslint/eslint

no-var should not fix variables named 'let'

Hey @mdjermanovic , thanks for the issue.

However, if you enable this no-var rule, you're intending to target an ES6 environment. If you're going to run your code at ES5 environment, you should disable this rule.

mdjermanovic

comment created time in 3 days

issue commenteslint/eslint

Won't detect .jsx aliased imports

Hey @jimmy-e , thanks for the issue.

This issue is from eslint-plugin-import, not ESLint itself. Please file issue at its repository.

jimmy-e

comment created time in 4 days

create barnchg-plane/vuepress-theme-simple-blog

branch : master

created branch time in 4 days

created repositoryg-plane/vuepress-theme-simple-blog

Forked from "vuepress-theme-simple", but provides better support for blog plugin.

created time in 4 days

push eventg-plane/blog

Pig Fang

commit sha ca0ea99f2409ad1a357473183ddd2a350d29b4ca

upgrade VuePress and use new theme

view details

push time in 4 days

issue closedeslint/eslint

New rule proposal: TSLint's no-string-literal

<!-- ESLint adheres to the JS Foundation Code of Conduct.

This template is for new rule proposals. If you are proposing a new rule, please continue on. If you are here for another reason, please see below:

1. To report a bug: https://eslint.org/docs/developer-guide/contributing/reporting-bugs
2. To request a rule change: https://eslint.org/docs/developer-guide/contributing/rule-changes
3. To request a change that is not a bug fix, rule change, or new rule: https://eslint.org/docs/developer-guide/contributing/changes
4. If you have any questions, please stop by our chatroom: https://gitter.im/eslint/eslint

Note that leaving sections blank will make it difficult for us to troubleshoot and we may have to close the issue.

-->

Please describe what the rule should do:

Forbids unnecessary string literal property access. Allows obj["prop-erty"] (can’t be a regular property access). Disallows obj["property"] (should be obj.property).

https://palantir.github.io/tslint/rules/no-string-literal/

What category of rule is this? (place an "X" next to just one item)

[ ] Warns about a potential error (problem) [ ] Suggests an alternate way of doing something (suggestion) [X] Enforces code style (layout) [ ] Other (please specify:)

Provide 2-3 code examples that this rule will warn about:

<!-- Put your code examples here -->

Disallow

obj["property"]

Allow

obj["prop-erty"]
obj["property"]

Why should this rule be included in ESLint (instead of a plugin)?

It was available in TSLint helps keep code clean and readable. In the case of using typescript the problem is If --noImplicitAny is turned off, property access via a string literal will be ‘any’ if the property does not exist. Despite this causing issues in typescript the code style is still generic to both javascript and typescript.

Are you willing to submit a pull request to implement this rule?

Maybe

closed time in 5 days

gruckion

issue commenteslint/eslint

New rule proposal: TSLint's no-string-literal

Closing this issue as it looks like the question has been answered. Please feel free to visit us in the ESLint Gitter if you have any other issues!

gruckion

comment created time in 5 days

issue closedeslint/eslint

New rule proposal: TSLint's no-default-export

<!-- ESLint adheres to the JS Foundation Code of Conduct.

This template is for new rule proposals. If you are proposing a new rule, please continue on. If you are here for another reason, please see below:

1. To report a bug: https://eslint.org/docs/developer-guide/contributing/reporting-bugs
2. To request a rule change: https://eslint.org/docs/developer-guide/contributing/rule-changes
3. To request a change that is not a bug fix, rule change, or new rule: https://eslint.org/docs/developer-guide/contributing/changes
4. If you have any questions, please stop by our chatroom: https://gitter.im/eslint/eslint

Note that leaving sections blank will make it difficult for us to troubleshoot and we may have to close the issue.

-->

Please describe what the rule should do:

Disallows default exports in ES6-style modules.

Use named exports instead.

https://palantir.github.io/tslint/rules/no-default-export/

What category of rule is this? (place an "X" next to just one item)

[X] Warns about a potential error (problem) [ ] Suggests an alternate way of doing something (suggestion) [ ] Enforces code style (layout) [ ] Other (please specify:)

Provide 2-3 code examples that this rule will warn about:

<!-- Put your code examples here --> Disallow

export default Bob = 5;

Allowed

export const Bob = 5

Why should this rule be included in ESLint (instead of a plugin)?

Named imports/exports promote clarity. In addition, current tooling differs on the correct way to handle default imports/exports. Avoiding them all together can help avoid tooling bugs and conflicts.

Are you willing to submit a pull request to implement this rule?

Maybe

closed time in 5 days

gruckion

issue commenteslint/eslint

New rule proposal: TSLint's no-default-export

Closing this issue as it looks like the question has been answered. Please feel free to visit us in the ESLint Gitter if you have any other issues!

gruckion

comment created time in 5 days

push eventbs-community/awesome-vuepress

Pig Fang

commit sha 84c114f2ef17c8aa842809ab84d4936a4934ee3e

feat: add blessing-skin-plugin-docs

view details

push time in 5 days

issue commenteslint/eslint

Installing eslint prevents devDependencies from being installed

devDependencies are for contributors of ESLint when they're developing ESLint, not for end users. We recommend you to read documentation of npm to get more help.

enoh-barbu

comment created time in 5 days

Pull request review commenteslint/eslint.github.io

Docs: Update release notes for eslint@6.0.0-rc.0

 tags: --- # ESLint v6.0.0-rc.0 released -We just pushed ESLint v6.0.0-rc.0, which is a minor release upgrade of ESLint. This release adds some new features and fixes several bugs found in the previous release.---+We just pushed ESLint v6.0.0-rc.0, which is a new prerelease version for ESLint v6. This release adds some new features and fixes several bugs found in the previous release. This release also has some breaking changes, so please read the following closely.  ## Highlights  This is a summary of the major changes you need to know about for this version of ESLint. +1. Now that BigInt and dynamic import are at stage 4, we have begun to accept PRs to incorporate them into core ESLint rules. The [`valid-typeof`](/docs/rules/valid-typeof) rule now supports BigInt. Please see https://github.com/eslint/eslint/issues/11803 to track our progress in fully supporting these newly standardized language features.
1. Now BigInt and dynamic import are at stage 4, so we have begun to accept PRs to incorporate them into core ESLint rules. The [`valid-typeof`](/docs/rules/valid-typeof) rule now supports BigInt. Please see https://github.com/eslint/eslint/issues/11803 to track our progress in fully supporting these newly standardized language features.
platinumazure

comment created time in 6 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-expressions

The hasSideEffect function will be improved in the future to detect more cases.

Once the improvement completed, some rules besides no-unused-expressions can be done.

g-plane

comment created time in 6 days

issue commenteslint/eslint

Dynamic Imports and BigInt have arrived at Stage 4 🎉

You can use babel-eslint as parser.

mysticatea

comment created time in 7 days

issue closedbs-community/blessing-skin-plugins

forum-intergration 无法对接论坛

我使用oneinstack的lamp,php 7.3.5, apache 2.4, 使用论坛对接插件对接flarum,报错提示 Array to string conversion (View: _/data/wwwroot/skin.axtjblog.cc/plugins/forum-integration/views/config.blade.php)https://skin.axtjblog.cc/laravel.log,并且会导致后面无法登录

closed time in 7 days

aoxiangtianji

issue closedeslint/eslint

no-unused-vars removal option

The version of ESLint you are using. 5.16.0

The problem you want to solve. Easily remove unused variables and especially imports.

I know that this was shot down in #7619 but that was to auto remove them on any --fix. This would only do so with an extra flag.

Your take on the correct solution to problem. Have a command line (--remove-unused) and config (removeUnused) option to remove unused variables and imports for you.

Are you willing to submit a pull request to implement this change? Possibly, if I can learn how create the flag and code needed. I haven't worked on a JS command line tool before.

closed time in 7 days

merlinpatt

issue commenteslint/eslint

no-unused-vars removal option

Maybe this issue can be closed, because ESLint core doesn't intend to provide auto fixing for removing unused variables and imports, and there is an existing third-party ESLint plugin (eslint-plugin-autofix) which has implemented this feature.

merlinpatt

comment created time in 7 days

create barnchaladdin-add/eslint-plugin-autofix

branch : no-useless-catch

created branch time in 7 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

@serhiipalash @corysimmons This has been fixed at #45 .

g-plane

comment created time in 7 days

delete branch aladdin-add/eslint-plugin-autofix

delete branch : fix-44

delete time in 7 days

push eventaladdin-add/eslint-plugin-autofix

Pig Fang

commit sha eb118f17dfca522ae0171296de1d264b7f5f32a5

Fix: fix no-unused-vars (fixes #44) (#45) * Fix: fix no-unused-vars (fixes #44) * add more cases * support array destructuring * add more cases

view details

push time in 7 days

issue closedaladdin-add/eslint-plugin-autofix

Auto fixing produces wrong syntax.

I noticed is that autofix/no-unused-vars doesn't work well with object destructuring.

before autofix

const { name, email } = this.props // "name" is unused

after autofix

const { , email } = this.props

coma is left

With unused imports everything works great.

Originally posted by @serhiipalash in https://github.com/aladdin-add/eslint-plugin-autofix/issues/33#issuecomment-500158744

closed time in 7 days

g-plane

push eventaladdin-add/eslint-plugin-autofix

Pig Fang

commit sha f46e4a116e2d18bcf3d912cc9f81185b10fcf7f5

add more cases

view details

push time in 7 days

Pull request review commentaladdin-add/eslint-plugin-autofix

Fix: fix no-unused-vars (fixes #44)

 ruleTester.run("no-unused-vars", rule, {             output: null,             errors: [{ type: "Identifier" }]         },+        {+            code: "var [a, b] = c",+            output: null,+            parserOptions: { ecmaVersion: 6 },+            errors: [{ type: "Identifier" }, { type: "Identifier" }]+        },

Done.

g-plane

comment created time in 7 days

push eventaladdin-add/eslint-plugin-autofix

Pig Fang

commit sha 69beb3e63b9812a958c4f3d0734ab33b7f783d83

support array destructuring

view details

push time in 7 days

Pull request review commentaladdin-add/eslint-plugin-autofix

Fix: fix no-unused-vars (fixes #44)

 ruleTester.run("no-unused-vars", rule, {             output: null,             errors: [{ type: "Identifier" }]         },-        {-            code: "var a = b = c()",-            output: null,-            errors: [{ type: "Identifier" }]-        },

I know, but that auto fixing will produce error.

g-plane

comment created time in 7 days

Pull request review commentaladdin-add/eslint-plugin-autofix

Fix: fix no-unused-vars (fixes #44)

 ruleTester.run("no-unused-vars", rule, {             output: null,             errors: [{ type: "Identifier" }]         },+        {+            code: "var [a, b] = c",+            output: null,+            parserOptions: { ecmaVersion: 6 },+            errors: [{ type: "Identifier" }, { type: "Identifier" }]+        },

Array destructing is order-sensitive.

g-plane

comment created time in 7 days

Pull request review commentaladdin-add/eslint-plugin-autofix

Fix: fix no-unused-vars (fixes #44)

 ruleTester.run("no-unused-vars", rule, {             output: null,             errors: [{ type: "Identifier" }]         },-        {-            code: "var a = b = c()",-            output: null,-            errors: [{ type: "Identifier" }]-        },

It can't.

let b
let a = b = c

fn(b)

It will be fixed as below, which is invalid:

let b
let b = c

fn(b)
g-plane

comment created time in 7 days

push eventaladdin-add/eslint-plugin-autofix

Pig Fang

commit sha 262016a1943c3a3175790664e464015efd099816

add more cases

view details

push time in 7 days

Pull request review commentaladdin-add/eslint-plugin-autofix

Fix: fix no-unused-vars (fixes #44)

 ruleTester.run("no-unused-vars", rule, {             output: null,             errors: [{ type: "Identifier" }]         },-        {-            code: "var a = b = c()",-            output: null,-            errors: [{ type: "Identifier" }]-        },

Yes, since it's unsafe:

var a = b = c

fn(b)
g-plane

comment created time in 7 days

create barnchaladdin-add/eslint-plugin-autofix

branch : fix-44

created branch time in 7 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

#44 .

g-plane

comment created time in 7 days

issue openedaladdin-add/eslint-plugin-autofix

Auto fixing produces wrong syntax.

I noticed is that autofix/no-unused-vars doesn't work well with object destructuring.

before autofix

const { name, email } = this.props // "name" is unused

after autofix

const { , email } = this.props

coma is left

With unused imports everything works great.

Originally posted by @serhiipalash in https://github.com/aladdin-add/eslint-plugin-autofix/issues/33#issuecomment-500158744

created time in 7 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

Non-related: it seems that our releases don't follow Semver.

g-plane

comment created time in 8 days

startedmicrosoft/PowerShellForGitHub

started time in 8 days

PR opened aladdin-add/eslint-plugin-autofix

Reviewers
Chore: clean up unused AST utils

以后如果用到其它函数时,再复制过来就可以了。

+14 -1345

0 comment

2 changed files

pr created time in 8 days

create barnchaladdin-add/eslint-plugin-autofix

branch : clean-up-ast-utils

created branch time in 8 days

Pull request review commentaladdin-add/eslint-plugin-autofix

Chore: not use non-public api

+/**

也许提取出来做成一个 npm 包会更好?

aladdin-add

comment created time in 8 days

Pull request review commentaladdin-add/eslint-plugin-autofix

Chore: not use non-public api

   ],   "dependencies": {     "eslint-rule-composer": "^0.3.0",+    "espree": "^5.0.1",+    "esutils": "^2.0.2",+    "lodash": "^4.17.11",     "string-similarity": "^3.0.0"   },   "devDependencies": {     "@not-an-aardvark/node-release-script": "^0.1.0",     "@types/eslint": "^4.16.6",-    "eslint": "^5.14.0",+    "eslint": "https://github.com/eslint/eslint.git",

这里没必要用 Git 上的代码吧?用 *latest 就可以了。

aladdin-add

comment created time in 8 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

@merlinpatt @corysimmons That PR was merged. Please wait for a new release.

g-plane

comment created time in 8 days

push eventaladdin-add/eslint-plugin-autofix

Pig Fang

commit sha c7c0226b65b963e46857e0f88e3fc58dc8cba534

add more cases

view details

push time in 8 days

push eventaladdin-add/eslint-plugin-autofix

Pig Fang

commit sha 63dd2d37830639bd1b1147c9c438d64857250624

support more patterns

view details

push time in 8 days

push eventaladdin-add/eslint-plugin-autofix

Pig Fang

commit sha 490500bc4d8636e5e70694247a97411c9b7f3f9a

update tests

view details

Pig Fang

commit sha 8f0ac5777a41842101fee996d2841f494314d7d7

support simple variables declarations

view details

push time in 9 days

issue commenteslint/eslint

no-unused-vars removal option

If you just want to sort imports, please check out eslint-plugin-import.

merlinpatt

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

那最后的方案是怎样?

g-plane

comment created time in 9 days

issue commentg-plane/eslint-plugin-project

do not use non-public api

话说使用 npm 或 Yarn 中「使用 file: 来指明依赖」的功能,是不是可以代替这个插件?就像 ESLint 本身的 codebase 那样。

aladdin-add

comment created time in 9 days

issue commenteslint/eslint

no-unused-vars removal option

However, I don't understand your use cases.

merlinpatt

comment created time in 9 days

issue closedeslint/eslint

ESLint: TypeError: Cannot set property 'prevName' of null

<!-- ESLint adheres to the JS Foundation Code of Conduct.

This template is for bug reports. If you are here for another reason, please see below:

1. To propose a new rule: https://eslint.org/docs/developer-guide/contributing/new-rules
2. To request a rule change: https://eslint.org/docs/developer-guide/contributing/rule-changes
3. To request a change that is not a bug fix, rule change, or new rule: https://eslint.org/docs/developer-guide/contributing/changes
4. If you have any questions, please stop by our chatroom: https://gitter.im/eslint/eslint

Note that leaving sections blank will make it difficult for us to troubleshoot and we may have to close the issue.

-->

Tell us about your environment

  • ESLint Version:
  • eslint@5.16.0
  • Node Version: v8.11.3
  • npm Version: 6.9.0

What parser (default, Babel-ESLint, etc.) are you using? parser: babel-eslint Please show your full configuration:

<details> <summary>Configuration</summary>

<!-- Paste your configuration below: -->


</details>

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

<!-- Paste the source code below: -->

class Select extends React.Component {
    constructor (props) {
        super(props);
    }

    plainChildrenTree (childrenTree) {
        return childrenTree.reduce((values, child) => {
            if (child.children.length) {
                values.push(...this.plainChildrenTree(child.children));
            } else {
                values.push({id: child.id, text: child.Title});
            }
            return values;
        }, []);
    }
}

<!-- Paste the command you used to run ESLint: -->


What did you expect to happen?

What actually happened? Please include the actual, raw output from ESLint.


TypeError: Cannot set property 'prevName' of null
    at SpreadElement (/Users/rus/.npm-packages/lib/node_modules/eslint/lib/rules/sort-keys.js:133:32)
    at listeners.(anonymous function).forEach.listener (/Users/rus/.npm-packages/lib/node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/rus/.npm-packages/lib/node_modules/eslint/lib/util/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/rus/.npm-packages/lib/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/Users/rus/.npm-packages/lib/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/Users/rus/.npm-packages/lib/node_modules/eslint/lib/util/node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (/Users/rus/.npm-packages/lib/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)
    at nodeQueue.forEach.traversalInfo (/Users/rus/.npm-packages/lib/node_modules/eslint/lib/linter.js:750:28)
    at Array.forEach (<anonymous>)```

**Are you willing to submit a pull request to fix this bug?**

closed time in 9 days

motionrus

issue commenteslint/eslint

ESLint: TypeError: Cannot set property 'prevName' of null

Closing because this question is out of scope.

motionrus

comment created time in 9 days

issue commenteslint/eslint

no-unused-vars removal option

@corysimmons Are you using React and JSX?

merlinpatt

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

对于第一点,我觉得意义不大,因为 auto fixing 本来就是方便用户,减少用户手工修改代码,但仅仅把表达式提取出来,最终还是要让用户去处理。

g-plane

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

所以,如果开启 no-unused-expression,就会:

// before
let array = [a()]

// after
// (no code)
g-plane

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

no-unused-expression 在下面这种情况也会报告:

[a()];
g-plane

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

Ref: https://github.com/estree/estree/blob/master/es5.md#expressions

g-plane

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

也许可以考虑直接删除没有副作用的表达式:

// before
let a = 123

// after
// (no code)

// before
let b = c

// after
// (no code)

如何?

g-plane

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

感觉这对于某些代码来说,修复后的结果可能有点怪:(但符合语法)

// before
let a = "";

// after
"";
g-plane

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

假定 c 是已被 used 的呢?

g-plane

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

比如就刚才那个,有什么好的方案吗?

let a = b(), c = d()
g-plane

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

现在实现也没问题的,应该不会太复杂,就是针对上面那种情况不知道思路。

g-plane

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

这样可能不好处理:

let a = b(), c = d()

遇到多个定义的就不修复?

g-plane

comment created time in 9 days

create barnchaladdin-add/eslint-plugin-autofix

branch : no-unused-vars

created branch time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

@aladdin-add 对于这种情况您怎么考虑?

let a = b()
g-plane

comment created time in 9 days

issue commentaladdin-add/eslint-plugin-autofix

no-unused-vars

Working for removing imports now.

g-plane

comment created time in 9 days

more