Skip to content

Commit

Permalink
Revert "use object.assign more"
Browse files Browse the repository at this point in the history
This reverts commit 659e557.
  • Loading branch information
bradzacher committed Jul 17, 2019
1 parent 4d657ef commit f62e9f7
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions utils/parse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'
"use strict"
exports.__esModule = true

const moduleRequire = require('./module-require').default
Expand All @@ -16,31 +16,29 @@ exports.default = function parse(path, content, context) {
if (!parserPath) throw new Error('parserPath is required!')

// hack: espree blows up with frozen options
parserOptions = Object.assign({}, parserOptions, {
ecmaFeatures: Object.assign({}, parserOptions.ecmaFeatures),

// always include comments and tokens (for doc parsing)
comment: true,
attachComment: true, // keeping this for backward-compat with older parsers
tokens: true,

// attach node locations
loc: true,
range: true,

// provide the `filePath` like eslint itself does, in `parserOptions`
// https://github.com/eslint/eslint/blob/3ec436ee/lib/linter.js#L637
filePath: path,

// @typescript-eslint/parser will parse the entire project with typechecking if you provide
// "project" or "projects" in parserOptions. Removing these options means the parser will
// only parse one file in isolate mode, which is much, much faster.
// https://github.com/benmosher/eslint-plugin-import/issues/1408#issuecomment-509298962
project: undefined,
projects: undefined,
})


parserOptions = Object.assign({}, parserOptions)
parserOptions.ecmaFeatures = Object.assign({}, parserOptions.ecmaFeatures)

// always include comments and tokens (for doc parsing)
parserOptions.comment = true
parserOptions.attachComment = true // keeping this for backward-compat with older parsers
parserOptions.tokens = true

// attach node locations
parserOptions.loc = true
parserOptions.range = true

// provide the `filePath` like eslint itself does, in `parserOptions`
// https://github.com/eslint/eslint/blob/3ec436ee/lib/linter.js#L637
parserOptions.filePath = path

// @typescript-eslint/parser will parse the entire project with typechecking if you provide
// "project" or "projects" in parserOptions. Removing these options means the parser will
// only parse one file in isolate mode, which is much, much faster.
// https://github.com/benmosher/eslint-plugin-import/issues/1408#issuecomment-509298962
delete parserOptions.project;
delete parserOptions.projects;

// require the parser relative to the main module (i.e., ESLint)
const parser = moduleRequire(parserPath)

Expand Down

0 comments on commit f62e9f7

Please sign in to comment.