-
Notifications
You must be signed in to change notification settings - Fork 248
Set up lint and test #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6d0af90
872b521
59d0c20
96c337d
7a86fa6
a1a8311
fe02d3e
7667266
3f2a3d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| 'use strict'; | ||
|
|
||
| module.exports = { | ||
| extends: ['eslint:recommended', 'prettier'], | ||
| plugins: ['prettier'], | ||
| parserOptions: { | ||
| ecmaVersion: 2017, | ||
| }, | ||
| env: { | ||
| node: true, | ||
| }, | ||
| rules: { | ||
| strict: 'error', | ||
| 'prettier/prettier': 'error', | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| node_modules/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1 @@ | ||
| **/__mocks__/** | ||
| **/__tests__/** | ||
| src |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| language: node_js | ||
| node_js: | ||
| - node | ||
| - 8 | ||
| - 6 | ||
| - 4 | ||
| cache: | ||
| yarn: true | ||
| branches: | ||
| only: | ||
| - master | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,23 +2,41 @@ | |
| "name": "eslint-plugin-jest", | ||
| "version": "21.2.0", | ||
| "description": "Eslint rules for Jest", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/facebook/jest.git" | ||
| }, | ||
| "repository": "jest-community/eslint-plugin-jest", | ||
| "license": "MIT", | ||
| "keywords": [ | ||
| "eslint", | ||
| "eslintplugin", | ||
| "eslint-plugin" | ||
| ], | ||
| "keywords": ["eslint", "eslintplugin", "eslint-plugin"], | ||
| "author": { | ||
| "name": "Jonathan Kim", | ||
| "email": "hello@jkimbo.com", | ||
| "url": "jkimbo.com" | ||
| }, | ||
| "main": "build/index.js", | ||
| "files": ["docs/", "rules/", "index.js"], | ||
| "peerDependencies": { | ||
| "eslint": ">=3.6" | ||
| }, | ||
| "scripts": { | ||
| "lint": "eslint . --ignore-pattern '!.eslintrc.js'", | ||
| "test": "jest", | ||
| "precommit": "lint-staged" | ||
| }, | ||
| "devDependencies": { | ||
| "eslint": "^4.10.0", | ||
| "eslint-config-prettier": "^2.7.0", | ||
| "eslint-plugin-prettier": "^2.3.1", | ||
| "husky": "^0.14.3", | ||
| "jest": "^21.2.1", | ||
| "lint-staged": "^4.3.0", | ||
| "prettier": "^1.8.1" | ||
| }, | ||
| "prettier": { | ||
| "singleQuote": true, | ||
| "trailingComma": "all" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you prefer it? Seems like a fb-ism. Happy to add, of course, I don't really care as long as it's formatted for me :D
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no preference, just that the diff would be smaller :D. We can scratch that |
||
| }, | ||
| "lint-staged": { | ||
| "*.js": ["eslint --fix", "git add"], | ||
| "*.{md,json}": ["prettier --write", "git add"] | ||
| }, | ||
| "jest": { | ||
| "testEnvironment": "node" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| 'use strict'; | ||
|
|
||
| const RuleTester = require('eslint').RuleTester; | ||
| const rules = require('../..').rules; | ||
|
|
||
| const ruleTester = new RuleTester(); | ||
| const expectedErrorMessage = 'Unexpected focused test.'; | ||
|
|
||
| ruleTester.run('no-focused-tests', rules['no-focused-tests'], { | ||
| valid: [ | ||
| 'describe()', | ||
| 'it()', | ||
| 'describe.skip()', | ||
| 'it.skip()', | ||
| 'test()', | ||
| 'test.skip()', | ||
| 'var appliedOnly = describe.only; appliedOnly.apply(describe)', | ||
| 'var calledOnly = it.only; calledOnly.call(it)', | ||
| ], | ||
|
|
||
| invalid: [ | ||
| { | ||
| code: 'describe.only()', | ||
| errors: [{ message: expectedErrorMessage, column: 10, line: 1 }], | ||
| }, | ||
| { | ||
| code: 'describe["only"]()', | ||
| errors: [{ message: expectedErrorMessage, column: 10, line: 1 }], | ||
| }, | ||
| { | ||
| code: 'it.only()', | ||
| errors: [{ message: expectedErrorMessage, column: 4, line: 1 }], | ||
| }, | ||
| { | ||
| code: 'it["only"]()', | ||
| errors: [{ message: expectedErrorMessage, column: 4, line: 1 }], | ||
| }, | ||
| { | ||
| code: 'test.only()', | ||
| errors: [{ message: expectedErrorMessage, column: 6, line: 1 }], | ||
| }, | ||
| { | ||
| code: 'test["only"]()', | ||
| errors: [{ message: expectedErrorMessage, column: 6, line: 1 }], | ||
| }, | ||
| { | ||
| code: 'fdescribe()', | ||
| errors: [{ message: expectedErrorMessage, column: 1, line: 1 }], | ||
| }, | ||
| { | ||
| code: 'fit()', | ||
| errors: [{ message: expectedErrorMessage, column: 1, line: 1 }], | ||
| }, | ||
| ], | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geez, I love Travis config being so simple compared to Circle 2