Skip to content

Commit

Permalink
Breaking: drop supporting ESLint 3.x, 4.x
Browse files Browse the repository at this point in the history
- upgrade eslint-scope to 4.0.0
- upgrade espree to 4.0.0

And upgrade ESLint setting of this repo.
  • Loading branch information
mysticatea committed Jul 2, 2018
1 parent c83140f commit 4e2cd77
Show file tree
Hide file tree
Showing 27 changed files with 1,544 additions and 755 deletions.
35 changes: 0 additions & 35 deletions .eslintrc.json

This file was deleted.

14 changes: 14 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends:
- plugin:@mysticatea/es2015
- plugin:@mysticatea/+node
- plugin:@mysticatea/+modules
overrides:
- files: "*.ts"
rules:
"@mysticatea/ts/no-use-before-define": "off"
- files: "typings/**"
rules:
node/no-missing-import:
- error
- allowModules:
- estree
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npm install --save-dev eslint vue-eslint-parser
```

- Requires Node.js 6.5.0 or later.
- Requires ESLint 3.9.0 or later.
- Requires ESLint 5.0.0 or later.

## 📖 Usage

Expand Down
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,42 @@
"index.js.map"
],
"peerDependencies": {
"eslint": ">=3.9.0"
"eslint": "^5.0.0"
},
"dependencies": {
"debug": "^3.1.0",
"eslint-scope": "^3.7.1",
"eslint-scope": "^4.0.0",
"eslint-visitor-keys": "^1.0.0",
"espree": "^3.5.2",
"esquery": "^1.0.0",
"lodash": "^4.17.4"
"espree": "^4.0.0",
"esquery": "^1.0.1",
"lodash": "^4.17.10"
},
"devDependencies": {
"@mysticatea/eslint-plugin": "^5.0.1",
"@types/debug": "0.0.30",
"@types/estree": "0.0.38",
"@types/lodash": "^4.14.91",
"@types/mocha": "^2.2.44",
"@types/node": "^6.0.85",
"babel-eslint": "^8.1.1",
"chokidar": "^1.7.0",
"codecov": "^3.0.0",
"cross-spawn": "^5.1.0",
"@types/lodash": "^4.14.110",
"@types/mocha": "^5.2.4",
"@types/node": "^6.0.113",
"babel-eslint": "^8.2.5",
"chokidar": "^2.0.4",
"codecov": "^3.0.2",
"cross-spawn": "^6.0.5",
"dts-bundle": "^0.7.3",
"eslint": "^4.14.0",
"eslint-config-mysticatea": "^12.0.0",
"fs-extra": "^5.0.0",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"nyc": "^11.4.1",
"eslint": "^5.0.1",
"fs-extra": "^6.0.1",
"mocha": "^5.2.0",
"npm-run-all": "^4.1.3",
"nyc": "^12.0.2",
"opener": "^1.4.3",
"rimraf": "^2.6.2",
"rollup": "^0.53.0",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup": "^0.60.7",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-watch": "^4.3.1",
"typescript": "~2.6.2",
"typescript-eslint-parser": "^11.0.0",
"wait-on": "^2.0.2",
"typescript": "^2.9.2",
"typescript-eslint-parser": "^16.0.1",
"wait-on": "^2.1.0",
"warun": "^1.0.0"
},
"scripts": {
Expand All @@ -57,12 +57,12 @@
"clean": "rimraf .nyc_output .temp coverage index.*",
"codecov": "nyc report --reporter lcovonly && codecov",
"coverage": "nyc report --reporter lcov && opener ./coverage/lcov-report/index.html",
"lint": "eslint src test --ext .ts",
"lint": "eslint src test --ext .js,.ts",
"setup": "git submodule update --init && cd test/fixtures/eslint && npm install",
"pretest": "run-s build lint",
"test": "nyc npm run _mocha",
"preupdate-fixtures": "npm run -s build",
"update-fixtures": "node test/tools/update-fixtures-ast.js",
"update-fixtures": "node scripts/update-fixtures-ast.js",
"preversion": "npm test",
"version": "npm run -s build",
"postversion": "git push && git push --tags",
Expand All @@ -71,7 +71,7 @@
"watch:tsc": "tsc --watch",
"watch:rollup": "wait-on .temp/index.js && rollup -c -o index.js --watch",
"watch:test": "wait-on index.js && warun index.js \"test/*.js\" \"test/fixtures/ast/*/*.json\" \"test/fixtures/*\" --debounce 1000 --no-initial -- nyc -r lcov npm run -s _mocha",
"watch:update-ast": "wait-on index.js && warun index.js \"test/fixtures/ast/*/*.vue\" -- node test/tools/update-fixtures-ast.js",
"watch:update-ast": "wait-on index.js && warun index.js \"test/fixtures/ast/*/*.vue\" -- node scripts/update-fixtures-ast.js",
"watch:coverage-report": "wait-on coverage/lcov-report/index.html && opener coverage/lcov-report/index.html"
},
"repository": {
Expand Down
14 changes: 3 additions & 11 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import sourcemaps from "rollup-plugin-sourcemaps"

const pkg = require("./package.json")
const deps = new Set(
[
"assert",
"events",
"path",
].concat(Object.keys(pkg.dependencies))
["assert", "events", "path"].concat(Object.keys(pkg.dependencies))
)

export default {
Expand All @@ -22,13 +18,9 @@ export default {
format: "cjs",
sourcemap: true,
sourcemapFile: "index.js.map",
strict: true,
},
plugins: [
sourcemaps(),
resolve(),
],
external: (id) => deps.has(id) || id.startsWith("lodash"),
plugins: [sourcemaps(), resolve()],
external: id => deps.has(id) || id.startsWith("lodash"),
banner: `/**
* @author Toru Nagashima <https://github.com/mysticatea>
* @copyright 2017 Toru Nagashima. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

const fs = require("fs")
const path = require("path")
const parser = require("../..")
const parser = require("../")

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------

const ROOT = path.join(__dirname, "../fixtures/ast")
const ROOT = path.join(__dirname, "../test/fixtures/ast")
const TARGETS = fs.readdirSync(ROOT)
const PARSER_OPTIONS = {
comment: true,
Expand Down Expand Up @@ -79,11 +79,13 @@ function getTree(source, ast) {
parser.AST.traverseNodes(ast.templateBody, {
enterNode(node) {
stack.push(current)
current.children.push(current = {
type: node.type,
text: source.slice(node.range[0], node.range[1]),
children: [],
})
current.children.push(
(current = {
type: node.type,
text: source.slice(node.range[0], node.range[1]),
children: [],
})
)
},
leaveNode() {
current = stack.pop()
Expand All @@ -103,8 +105,13 @@ for (const name of TARGETS) {
const tokenRangesPath = path.join(ROOT, `${name}/token-ranges.json`)
const treePath = path.join(ROOT, `${name}/tree.json`)
const source = fs.readFileSync(sourcePath, "utf8")
const actual = parser.parse(source, Object.assign({ filePath: sourcePath }, PARSER_OPTIONS))
const tokenRanges = getAllTokens(actual).map(t => source.slice(t.range[0], t.range[1]))
const actual = parser.parse(
source,
Object.assign({ filePath: sourcePath }, PARSER_OPTIONS)
)
const tokenRanges = getAllTokens(actual).map(t =>
source.slice(t.range[0], t.range[1])
)
const tree = getTree(source, actual)

console.log("Update:", name)
Expand Down
Loading

0 comments on commit 4e2cd77

Please sign in to comment.