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.

sourceText.startsWith is not a function (v4.6.0)

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.6.0
  • Node Version: 8.4.0
  • npm Version: 5.3.0

What parser (default, Babel-ESLint, etc.) are you using? babel-eslint

Please show your full configuration:

Configuration
module.exports = {
  root: true,
  parser: 'babel-eslint',
  parserOptions: {
    sourceType: 'module'
  },
  env: {
    browser: true,
    node: true
  },
  globals: {
    __static: true
  },
  plugins: [
    'html'
  ],
  'rules': {
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
  }
}

What did you do? Please include the actual source code causing the issue. Using the electron-vue boilerplate, default scaffold with eslint enabled using an empty configuration (also tried, using eslint-config-standard and eslint-config-airbnb-base).

What did you expect to happen? Expected code to be linted and fixed when possible. It has worked without error beforehand, but the new 4.6.0 version fails and produces the below error log. Reverting back to 4.5.0 does not produce the error and works as expected.

# original command, removing formatter doesn't fix either
eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src

What actually happened? Please include the actual, raw output from ESLint.

> j@0.0.0 lint:fix /Users/gregholguin/Documents/Projects/playground/j
> eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src

sourceText.startsWith is not a function
TypeError: sourceText.startsWith is not a function
    at Function.SourceCodeFixer.applyFixes (/Users/gregholguin/Documents/Projects/playground/j/node_modules/eslint/lib/util/source-code-fixer.js:76:26)
    at Function.SourceCodeFixer.applyFixes (/Users/gregholguin/Documents/Projects/playground/j/node_modules/eslint-plugin-html/src/index.js:152:23)
    at Linter.verifyAndFix (/Users/gregholguin/Documents/Projects/playground/j/node_modules/eslint/lib/linter.js:1258:43)
    at processText (/Users/gregholguin/Documents/Projects/playground/j/node_modules/eslint/lib/cli-engine.js:196:34)
    at processFile (/Users/gregholguin/Documents/Projects/playground/j/node_modules/eslint/lib/cli-engine.js:245:18)
    at executeOnFile (/Users/gregholguin/Documents/Projects/playground/j/node_modules/eslint/lib/cli-engine.js:585:25)
    at fileList.forEach.fileInfo (/Users/gregholguin/Documents/Projects/playground/j/node_modules/eslint/lib/cli-engine.js:622:13)
    at Array.forEach (<anonymous>)
    at CLIEngine.executeOnFiles (/Users/gregholguin/Documents/Projects/playground/j/node_modules/eslint/lib/cli-engine.js:621:18)
    at Object.execute (/Users/gregholguin/Documents/Projects/playground/j/node_modules/eslint/lib/cli.js:181:107)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
BenoitZugmeyercommented, Sep 2, 2017

eslint-plugin-html 3.2.1 supports ESLint 4.6+. This issue can be closed.

1reaction
BenoitZugmeyercommented, Sep 2, 2017

Sure thing: if your PR to allow autofix with plugins lands, I probably won’t need to patch SourceCodeFixer anymore. I didn’t test it yet, but it looks good. I’ll still need to patch eslint.verify, mainly to allow configuring file extensions to be considered as HTML via the eslintrc file. But this is another story, and your PR would make things simpler for me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

startsWith is not a function getting called for no reason
startsWith ("keyword") because the parameter of start with must be a string. So that will work better this way for (var i =...
Read more >
[Solved] TypeError: startsWith is not a function - ItsJavaScript
The TypeError: startsWith is not a function occurs if we call a startsWith() method on the value that is not of a type...
Read more >
TypeError: startsWith is not a function in JavaScript | bobbyhadz
The "startsWith is not a function" error occurs when we call the startsWith() method on a value that is not a string. To...
Read more >
Performance Improvements in .NET 7
NET 7 is fast. Really fast. This post deep-dives into hundreds of performance improvements that contributed to that reality.
Read more >
Functions - Planview Customer Success Center
For example, MM/DD/yyyy applied to 03/18/01 returns "Mar 3, 01". Examples: input FormatDate(Date(2008, 6, 4), 'M/d/yy'). output 6/4/08.
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