Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !6980
An error occurred while fetching the assigned milestone of the selected merge_request.

Stop hiding the column number of ESLint errors

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/justingrant/patch-1 into master 6 years ago
  • Overview 10
  • Commits 2
  • Pipelines 0
  • Changes 2

Created by: justingrant

Currently, CRA's npm start output only reports the line number of ESLint errors but hides the column numbers. This makes it harder for IDE users to leverage the time-saving features provided by IDEs like VSCode to deal with build errors:

  • devs can't one-click to navigate from the build error message to the exact spot in the code where the problem is.
  • the code editor won't show the little red sqiggly line under the exact spot in the code where the problem is.

This PR removes one line of code (originally introduced in #5174 last year) that removes column numbers from ESLint errors. Here's the current code. As you can see, it has no side effects-- it removes column numbers but doesn't do any other changes to the string. https://github.com/facebook/create-react-app/blob/4397d069d903c29927526d6fe4e7ba1b5edb136d/packages/react-dev-utils/formatWebpackMessages.js#L44-L46

Here's what existing errors look like:

./src/Calendar.tsx
  Line 19:  Unnecessary escape character: \.  no-useless-escape

Here's what errors will look like after this PR:

./src/Calendar.tsx
  Line 19:21:  Unnecessary escape character: \.  no-useless-escape
Compare
  • master (base)

and
  • latest version
    b849067c
    2 commits, 2 years ago

2 files
+ 2
- 5

    Preferences

    File browser
    Compare changes
packages/rea‎ct-dev-utils‎
formatWebpac‎kMessages.js‎ +0 -3
test/fixtures/‎…/__snapshots__‎
index.tes‎t.js.snap‎ +2 -2
packages/react-dev-utils/formatWebpackMessages.js
+ 0
- 3
  • View file @ b849067c

  • Edit in single-file editor

  • Open in Web IDE


@@ -41,9 +41,6 @@ function formatMessage(message) {
/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g,
`${friendlySyntaxErrorLabel} $3 ($1:$2)\n`
);
// Remove columns from ESLint formatter output (we added these for more
// accurate syntax errors)
message = message.replace(/Line (\d+):\d+:/g, 'Line $1:');
// Clean up export errors
message = message.replace(
/^.*export '(.+?)' was not found in '(.+?)'.*$/gm,
test/fixtures/webpack-message-formatting/__snapshots__/index.test.js.snap
+ 2
- 2
  • View file @ b849067c

  • Edit in single-file editor

  • Open in Web IDE


@@ -62,7 +62,7 @@ Object {
Failed to compile.
./src/App.js
Line 4: 'b' is not defined no-undef
Line 4:13: 'b' is not defined no-undef
Search for the keywords to learn more about each error.
@@ -79,7 +79,7 @@ Object {
Compiled with warnings.
./src/App.js
Line 3: 'foo' is defined but never used no-unused-vars
Line 3:10: 'foo' is defined but never used no-unused-vars
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference:
Source branch: github/fork/justingrant/patch-1

Menu

Explore Projects Groups Snippets