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

Plugin not wokring in VSCode #357

Open
netdjw opened this issue Sep 25, 2022 · 1 comment
Open

Plugin not wokring in VSCode #357

netdjw opened this issue Sep 25, 2022 · 1 comment
Labels

Comments

@netdjw
Copy link

netdjw commented Sep 25, 2022

Describe the bug

I followed the documentation to set up this plugin in my project, and I created this .eslint.json file:

{
  "root": true,
  "ignorePatterns": [
    "projects/**/*"
  ],
  "overrides": [
    {
      "files": [
        "*.spec.ts"
      ],
      "env": {
        "jasmine": true
      },
      "parser": "@typescript-eslint/parser",
      "parserOptions": {
        "ecmaVersion": 2020,
        "sourceType": "module",
        "project": [
          "./tsconfig.app.json"
        ],
        "createDefaultProgram": true
      },
      "extends": [
        "plugin:@angular-eslint/ng-cli-compat",
        "plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
        "plugin:@angular-eslint/template/process-inline-templates",
        "plugin:jasmine/recommended",
        "eslint:recommended",
        "plugin:prettier/recommended",
        "prettier"
      ],
      "plugins": [
        "@angular-eslint",
        "prettier",
        "eslint-plugin-no-null",
        "eslint-plugin-unicorn",
        "jasmine"
      ],
      "rules": {
          // here are many other plugins rules
        "expect-matcher": 1,
        "expect-single-argument": 1,
        "missing-expect": [2, "expect()"],
        "named-spy": 1,
        "new-line-before-expect": 1,
        "new-line-between-declarations": 1,
        "no-expect-in-setup-teardown": 1,
        "no-focused-tests": 2,
        "no-global-setup": 2,
        "no-spec-dupes": 1,
        "no-suite-callback-args": 2,
        "no-suite-dupes": 1,
        "no-unsafe-spy": 1,
        "prefer-jasmine-matcher": 1,
        "prefer-toBeUndefined": 2
      }
    },
    // here is other overrides
  ]
}

I use VSCode as code editor (I don't know is this mean something or not).

In the OUTPUT I see this:

[Info  - 9:34:08 AM] ESLint server is starting
[Info  - 9:34:08 AM] ESLint server running in node v16.14.2
[Info  - 9:34:08 AM] ESLint server is running.
[Info  - 9:34:09 AM] ESLint library loaded from: /home/djw/code/myproject/angular/node_modules/eslint/lib/api.js

So there is no error or warning.

A clear and concise description of what the bug is

To Reproduce

Create this spec.ts file:

describe('Post model', () => {
  const mockPresentDate = '2022-06-03';
  let model: PostInterface;

  beforeEach(() => {
    // ....
  });

  it('should be set published_at property, when publish_date is updated', () => {
    model.publish_date = '2021-04-25';

    expect(model.published_at).toEqual('2021-04-25 00:00:00');
  });
  fit('should be set meta_description', () => {

  });
  it('should be set meta_description', () => {
    const text = 'Lorem ipsum...';
    model.meta_description = text;

    expect(model.meta_description.length).toEqual(255);
    expect(model.meta_description).toEqual('Lorem ipsum...');
  });
});

So I broke several rules with this code, like missing-expect, new-line-before-expect, no-spec-dupes.

Steps to reproduce the behaviour

Expected behaviour is to give me errors and warnings,

A clear and concise description of what you expected to happen.

Context

  • Node.js version: v16.14.2
  • eslint-plugin-jasmine version: 4.1.3
  • eslint version: 8.2.0
  • Operating system: Ubuntu 20.04 in WSL2 running on Windows 10 Home

Additonal info

I tried to run with ng lint command, there isn't an error or warning too.

@netdjw netdjw added the bug label Sep 25, 2022
@osamayelk
Copy link
Contributor

I built a minimum reproduction environment just to make sure and here's what I found:
Your rules should be prefixed with jasmine/

so they should look like this:

{
  "root": true,
  "ignorePatterns": [
    "projects/**/*"
  ],
  "overrides": [
    {
      "files": [
        "*.spec.ts"
      ],
      "env": {
        "jasmine": true
      },
      "parser": "@typescript-eslint/parser",
      "parserOptions": {
        "ecmaVersion": 2020,
        "sourceType": "module",
        "project": [
          "./tsconfig.app.json"
        ],
        "createDefaultProgram": true
      },
      "extends": [
        "plugin:@angular-eslint/ng-cli-compat",
        "plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
        "plugin:@angular-eslint/template/process-inline-templates",
        "plugin:jasmine/recommended",
        "eslint:recommended",
        "plugin:prettier/recommended",
        "prettier"
      ],
      "plugins": [
        "@angular-eslint",
        "prettier",
        "eslint-plugin-no-null",
        "eslint-plugin-unicorn",
        "jasmine"
      ],
      "rules": {
          // here are many other plugins rules
        "jasmine/expect-matcher": 1,
        "jasmine/expect-single-argument": 1,
        "jasmine/missing-expect": [2, "expect()"],
        "jasmine/named-spy": 1,
        "jasmine/new-line-before-expect": 1,
        "jasmine/new-line-between-declarations": 1,
        "jasmine/no-expect-in-setup-teardown": 1,
        "jasmine/no-focused-tests": 2,
        "jasmine/no-global-setup": 2,
        "jasmine/no-spec-dupes": 1,
        "jasmine/no-suite-callback-args": 2,
        "jasmine/no-suite-dupes": 1,
        "jasmine/no-unsafe-spy": 1,
        "jasmine/prefer-jasmine-matcher": 1,
        "jasmine/prefer-toBeUndefined": 2
      }
    },
    // here is other overrides
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants