Skip to content

Commit

Permalink
fix(package): updated versions with location calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Alpert committed Jun 24, 2018
1 parent 80d21cf commit 48fb8cc
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 16 deletions.
1 change: 1 addition & 0 deletions __mocks__/eslint-plugin-roku.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../src')
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"eslint": "5.0.0"
},
"dependencies": {
"@roku-road/bright": "1.2.6"
"@roku-road/bright": "1.2.7"
},
"devDependencies": {
"@types/eslint": "4.16.2",
Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import { ast, visitorKeys } from '@roku-road/bright'
// tslint:disable-next-line:no-var-requires
const { name, version } = require('../package.json')

const warnings = [ 'no-print', 'function-no-return', 'sub-to-function' ]
const errors = [ 'no-stop' ]
const warnings = ['no-print', 'function-no-return', 'sub-to-function']
const errors = ['no-stop']

const allRules = [ ...warnings, ...errors ].sort()
const allRules = [...warnings, ...errors].sort()

const makeRules = () => {
const mapped = {}

allRules.map((rule) => (mapped[rule] = require(`./rules/${rule}`)))
allRules.map(rule => (mapped[rule] = require(`./rules/${rule}`)))

return mapped
}

const addRule = (level = 'warn', mapped = {}) => (rule) => (mapped[`roku/${rule}`] = level)
const addRule = (level = 'warn', mapped = {}) => rule => (mapped[`roku/${rule}`] = level)

const ruleConfig = () => {
const mapped = {}
Expand All @@ -42,7 +42,7 @@ const parseForESLint = (code: string) => {
const configs = {
recommended: {
parser: name,
plugins: [ 'roku' ],
plugins: ['roku'],
rules: ruleConfig()
}
}
Expand Down
1 change: 0 additions & 1 deletion src/rules/function-no-return.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const create = (context: Rule.RuleContext) => {
name,
type
},
loc,
messageId,
node
})
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-print.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const create = (context: Rule.RuleContext) => {
PrintStatement(node) {
context.report({
data: { statement: 'print' },
loc: node.loc,
messageId: 'unexpected',
node
})
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const create = (context: Rule.RuleContext) => {
StopStatement(node) {
context.report({
data: { statement: 'stop' },
loc: node.loc,
messageId: 'unexpected',
node
})
Expand Down
1 change: 0 additions & 1 deletion src/rules/sub-to-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const create = (context: Rule.RuleContext) => {
name,
type
},
loc: node.ReturnType.loc,
messageId: 'noReturn',
node
})
Expand Down
3 changes: 1 addition & 2 deletions tests/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ const settings = {
parser,
plugins: PLUGIN.configs.recommended.plugins,
rules: PLUGIN.configs.recommended.rules,
// rules: ,
useEslintrc: false
}

const cli = new CLIEngine(settings)
// const formatter = cli.getFormatter('stylish')
const formatter = cli.getFormatter('stylish')

describe('Plugin', () => {
it(`Should be able to use plugin v${PLUGIN.version}`, () => {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
node-fetch "^2.1.1"
url-template "^2.0.8"

"@roku-road/bright@1.2.6":
version "1.2.6"
resolved "https://registry.yarnpkg.com/@roku-road/bright/-/bright-1.2.6.tgz#be63ae47b8ca4b5dfd75b07d9264b33c250ffbc5"
"@roku-road/bright@1.2.7":
version "1.2.7"
resolved "https://registry.yarnpkg.com/@roku-road/bright/-/bright-1.2.7.tgz#996633b73ece1c97d24ee0dd58368f83da16fe03"
dependencies:
chevrotain "3.6.1"
lodash "4.17.10"
Expand Down

0 comments on commit 48fb8cc

Please sign in to comment.