question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: @nrwl/storybook: stories are not linted - it's on purpose or a bug?

See original GitHub issue

Expected Behavior

I see two options how to approach this:

  • use tsconfig.json as lint entry point within architect lint target
"lint": {
          "builder": "@nrwl/linter:lint",
          "options": {
            "linter": "eslint",
            "config": "libs/react-one/.eslintrc",
            "tsConfig": [
-              "libs/react-one/tsconfig.lib.json",
-              "libs/react-one/tsconfig.spec.json"
+              "libs/react-one/tsconfig.json"
            ],
            "exclude": ["**/node_modules/**", "!libs/react-one/**"]
          }
        },
  • generate tsconfig.stories.json when storybook:init is executed and update particular project workspace.json accordingly
"lint": {
          "builder": "@nrwl/linter:lint",
          "options": {
            "linter": "eslint",
            "config": "libs/react-one/.eslintrc",
            "tsConfig": [
              "libs/react-one/tsconfig.lib.json",
              "libs/react-one/tsconfig.spec.json"
+              "libs/react-one/tsconfig.stories.json"
            ],
            "exclude": ["**/node_modules/**", "!libs/react-one/**"]
          }
        },

with tsconfig.stories.json

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "../../dist/out-tsc",
    "types": [
      "node"
    ]
  },
  "include": [
    "**/*.stories.ts",
    "**/*.stories.js"
  ]
}

Current Behavior

  • .stories are not linted

image image

Context

>  NX  Report complete - copy this into the issue template

  @nrwl/angular : Not Found
  @nrwl/cli : 9.2.3
  @nrwl/cypress : 9.2.3
  @nrwl/eslint-plugin-nx : 9.2.3
  @nrwl/express : Not Found
  @nrwl/jest : 9.2.3
  @nrwl/linter : 9.2.3
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : 9.2.3
  @nrwl/react : 9.2.3
  @nrwl/schematics : Not Found
  @nrwl/tao : 9.2.3
  @nrwl/web : 9.2.3
  @nrwl/workspace : 9.2.3
  typescript : 3.8.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
juristrcommented, Jul 29, 2020

Question: will lint builder properly resolve provided relative path? “include”: [“…/src/**/*”] see source

🤔 good question. I did a quick try by referencing the .storybook/tsconfig and it seemed to work. But guess you’ll have to give it a try and test some edge-cases to be 100% sure 😃

I’ll try to send PR till end of this week 🤞

cool 🎉. Just let me or @mandarini know if you have any doubts or questions.

1reaction
juristrcommented, Jul 28, 2020

Hey @Hotell 👋 . Just discussed the options with @mandarini. We would go with option 1, so

  1. fix the matching of the stories in the react storybook setup as you correctly pointed out
  2. add the storybook tslint to the linter configuration in angular.json / workspace.json. But instead of generating a new one we could directly use the one in the .storybook/tsconfig.json which is generated inside the lib that has storybook support.

Would be cool if you could provide a PR on this 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is linting and how can it save you time? - freeCodeCamp
Simply put, a linter is a tool that programmatically scans your code with the goal of finding issues that can lead to bugs...
Read more >
storybookjs/storybook (Raised $170.00) - Issuehunt
[Bug]: Angular function Input in component is not set from story args ... Storybook for Angular generates errors when component uses FontAwesome icons....
Read more >
nrwl/storybook: Versions - Openbase
Full version history for @nrwl/storybook including change logs.
Read more >
Some Serious Bugs - [Web Stories] Review - WordPress.org
Now recently this happened that the embedded story is not loading at all. There is a blank space at the embed location. Update:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found