Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to check if no-restricted-* eslint rules no longer works #151310

Closed
watson opened this issue Feb 15, 2023 · 1 comment · Fixed by #151434
Closed

Add test to check if no-restricted-* eslint rules no longer works #151310

watson opened this issue Feb 15, 2023 · 1 comment · Fixed by #151434
Assignees
Labels
Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!

Comments

@watson
Copy link
Contributor

watson commented Feb 15, 2023

As discovered in #110422 and currently being fixed in #151023, it's very easy to mess up ESLint rules so that they no longer trigger and there's no way to know obvious indication of the regression.

We should create tests to ensure that the expected validation errors actually do occur. To achieve this we can use this plugin which is already loaded in our ESLint config. This is similar to how @ts-expect-error works.

Example usage where ESLint will produce an error if the no-restricted-imports error isn't produced:

import { set } from 'lodash'; // eslint-disable-line no-restricted-imports

(I've assigned myself because I've already have a working implementation of this locally which just needs some final touches)

@watson watson added the Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! label Feb 15, 2023
@watson watson self-assigned this Feb 15, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants