0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-15 18:16:12 -05:00
denoland-deno/tests
Bartek Iwańczuk f08ca6414b
feat(lint): add JavaScript plugin support (#27203)
This commit adds an unstable lint plugin API.

Plugins are specified in the `deno.json` file under
`lint.plugins` option like so:

```
{
  "lint": {
    "plugins": [
      "./plugins/my-plugin.ts",
      "jsr:@deno/lint-plugin1",
      "npm:@deno/lint-plugin2"
    ]
  }
}
```

The API is considered unstable and might be subject
to changes in the future.

Plugin API was modelled after ESLint API for the 
most part, but there are no guarantees for compatibility.
The AST format exposed to plugins is closely modelled
after the AST that `typescript-eslint` uses.

Lint plugins use the visitor pattern and can add
diagnostics like so:

```
export default {
  name: "lint-plugin",
  rules: {
    "plugin-rule": {
      create(context) {
        return {
          Identifier(node) {
            if (node.name === "a") {
              context.report({
                node,
                message: "should be b",
                fix(fixer) {
                  return fixer.replaceText(node, "_b");
                },
              });
            }
          },
        };
      },
    },
  },
} satisfies Deno.lint.Plugin;
```

Besides reporting errors (diagnostics) plugins can provide
automatic fixes that use text replacement to apply changes.

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2025-02-05 16:59:24 +01:00
..
config chore: use @std prefix for internal module specifiers (#24543) 2024-07-25 10:26:54 +10:00
ffi chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
integration feat(lint): add JavaScript plugin support (#27203) 2025-02-05 16:59:24 +01:00
napi fix(ext/napi): napi_is_buffer tests for ArrayBufferView (#27956) 2025-02-04 14:30:40 +00:00
node_compat fix(ext/node): clear tz cache when setting process.env.TZ (#27826) 2025-01-28 18:13:41 +05:30
registry feat: TypeScript 5.7 (#27857) 2025-01-31 16:07:42 -05:00
specs feat(lint): add JavaScript plugin support (#27203) 2025-02-05 16:59:24 +01:00
testdata chore: move bench test to spec test (#27970) 2025-02-05 10:49:10 -05:00
unit feat(lint): add JavaScript plugin support (#27203) 2025-02-05 16:59:24 +01:00
unit_node fix(ext/node): implement SQLite Session API (#27909) 2025-02-04 21:59:13 +05:30
util feat: TypeScript 5.7 (#27857) 2025-01-31 16:07:42 -05:00
wpt fix(ext/crypto): export private x25519 JWK key (#27828) 2025-01-27 22:25:00 +05:30
Cargo.toml chore: update ensure_registry_files_local to handle scoped packages (#27801) 2025-01-24 21:47:15 +09:00
lib.rs chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
README.md chore: continue tests/ re-org (#22396) 2024-02-12 17:13:14 -07:00

Deno Integration Tests