tools icon indicating copy to clipboard operation
tools copied to clipboard

`noWith`, no-with

Open ematipico opened this issue 3 years ago • 4 comments

https://eslint.org/docs/latest/rules/no-with

ematipico avatar Dec 06 '22 12:12 ematipico

I have started an investigation to implement this rule on linter, but now i'm blocked trying to understand how as this evidence are showing who have a parser step to check javascript on strict mode on top of the cascade:

..\rome-tools-samples\no-with-sample.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × `with` statements are not allowed in strict mode

  > 1 │ with (point) {
      │ ^^^^^^^^^^^^^^
  > 2 │   r = Math.sqrt(x * x + y * y); // is r a member of point?
  > 3 │ }
      │ ^


Compared 1 file(s) in 8ms
Skipped 1 file(s)
Error: no files were processed in the specified paths.
error: process didn't exit successfully: `target\debug\rome.exe format ..\rome-tools-samples\no-with-sample.js` (exit code: 1)

How can i proceed, to enable the rule i was made for use with?

ktfth avatar Dec 10 '22 01:12 ktfth

https://github.com/rome/tools/pull/4025 if needed to understand what i have done at the current moment.

ktfth avatar Dec 10 '22 01:12 ktfth

I have no answer for your issue. However, you can test your rule with a test. By default, there are in script mode if I am not wrong. You may opt to strict mode by using esm (e.g. export).

Conaclos avatar Dec 10 '22 11:12 Conaclos

The keyword with is allowed only in scripts. So when trying in the playground, you must set Script in the settings.

As for the linting, you must create .cjs files, which will recognized as script files.

ematipico avatar Dec 10 '22 12:12 ematipico

I have followed all the breads on the way based on your suggestions and I believe it's almost ready for the next phase, but something have popped up to me on the just check-ready step. See the result:

...
cargo codegen-aria
error: no such subcommand: `codegen-aria`

        View all installed commands with `cargo --list`
error: Recipe `codegen` failed on line 9 with exit code 101
error: Recipe `check-ready` failed on line 34 with exit code 101

Currently I'm developing on a windows machine, and maybe this could be different on that kind of environment. But the draft pull request is on the way. Both of you, @Conaclos and @ematipico have some clues and tips to solve this problem?

Thank you so much for the help, we have here an incredible team.

ktfth avatar Dec 11 '22 00:12 ktfth

For the time being, you can remove that command codegen-aria from justfile.

ematipico avatar Dec 11 '22 08:12 ematipico

Now ready for review and made some changes based on their visions.

https://github.com/rome/tools/pull/4025

ktfth avatar Dec 11 '22 15:12 ktfth