Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1c648cd
Showing
9 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Dependencies | ||
node_modules | ||
package-lock.json | ||
yarn.lock | ||
|
||
# Intellij idea | ||
*.iml | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.travis.yml | ||
tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
language: node_js | ||
node_js: | ||
- 8 | ||
- 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Nuxt ESLint Config | ||
|
||
[ESlint](https://eslint.org/) config used for Nuxt.js | ||
|
||
## Usage | ||
|
||
Do you want to add the config to your own projects? There you go: | ||
|
||
1. Add this package to your devDependencies (`npm i -D @nuxtjs/eslint-config` or `yarn add -D @nuxtjs/eslint-config`) | ||
2. Add the [`peerDependencies`](./package.json) to your project | ||
|
||
`npm i -D eslint eslint-config-standard eslint-plugin-import eslint-plugin-jest eslint-plugin-node eslint-plugin-promise eslint-plugin-standard eslint-plugin-vue` | ||
|
||
3. Create a `.eslintrc.js` file | ||
|
||
4. Extend our config (you can use just the scope name as ESLint will assume the `eslint-config` prefix): | ||
|
||
```json | ||
{ | ||
"extends": [ | ||
"@nuxtjs" | ||
] | ||
} | ||
``` | ||
|
||
|
||
## License | ||
|
||
Setup inspired by [eslint-config-standard](https://github.com/standard/eslint-config-standard) | ||
|
||
MIT - Nuxt.js team |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
node: true, | ||
'jest/globals': true | ||
}, | ||
extends: [ | ||
'standard', | ||
'plugin:import/errors', | ||
'plugin:import/warnings', | ||
'plugin:vue/recommended' | ||
], | ||
plugins: [ | ||
'vue', | ||
'jest' | ||
], | ||
settings: { | ||
'import/resolver': { | ||
node: { extensions: ['.js', '.mjs'] } | ||
} | ||
}, | ||
rules: { | ||
// Enforce import order | ||
'import/order': 2, | ||
|
||
// Imports should come first | ||
'import/first': 2, | ||
|
||
// Other import rules | ||
'import/no-mutable-exports': 2, | ||
|
||
// Allow unresolved imports | ||
'import/no-unresolved': 0, | ||
|
||
// Allow paren-less arrow functions only when there's no braces | ||
'arrow-parens': [2, 'as-needed', { requireForBlockBody: true }], | ||
|
||
// Allow async-await | ||
'generator-star-spacing': 0, | ||
|
||
// Allow debugger during development | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, | ||
|
||
// Prefer const over let | ||
'prefer-const': [2, { | ||
'destructuring': 'any', | ||
'ignoreReadBeforeAssign': false | ||
}], | ||
|
||
// No single if in an "else" block | ||
'no-lonely-if': 2, | ||
|
||
// Force curly braces for control flow | ||
curly: 2, | ||
|
||
// No async function without await | ||
'require-await': 2, | ||
|
||
// Force dot notation when possible | ||
'dot-notation': 2, | ||
|
||
'no-var': 2, | ||
|
||
// Do not allow console.logs etc... | ||
'no-console': 2, | ||
'space-before-function-paren': [2, { | ||
anonymous: 'always', | ||
named: 'never' | ||
}], | ||
'vue/no-parsing-error': [2, { | ||
'x-invalid-end-tag': false | ||
}], | ||
'vue/max-attributes-per-line': [2, { | ||
'singleline': 5 | ||
}] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "@nuxtjs/eslint-config", | ||
"version": "0.0.1", | ||
"description": "Nuxt.js eslint config", | ||
"contributors": [ | ||
"Alexander Lichter <npm@lichter.io>" | ||
], | ||
"license": "MIT", | ||
"homepage": "https://github.com/nuxt/eslint-config", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/nuxt/eslint-config.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/nuxt/eslint-config/issues" | ||
}, | ||
"scripts": { | ||
"lint": "eslint . --config=index.js", | ||
"test": "npm run lint && jest", | ||
"release": "standard-version && git push --follow-tags && npm publish" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"peerDependencies": { | ||
"eslint": ">=5.0.0", | ||
"eslint-config-standard": ">=12.0.0", | ||
"eslint-plugin-import": ">=2.14.0", | ||
"eslint-plugin-jest": ">=21.24.1", | ||
"eslint-plugin-node": ">=7.0.1", | ||
"eslint-plugin-promise": ">=4.0.1", | ||
"eslint-plugin-standard": ">=4.0.0", | ||
"eslint-plugin-vue": ">=5.0.0-beta.3" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.0.0", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-jest": "^21.24.1", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-promise": "^4.0.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"eslint-plugin-vue": "^5.0.0-beta.3", | ||
"jest": "^23.6.0", | ||
"standard-version": "^4.4.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": [ | ||
"@nuxtjs" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const config = require('../') | ||
|
||
test('test basic properties of config', () => { | ||
expect(isObject(config.env)).toBe(true) | ||
expect(isObject(config.rules)).toBe(true) | ||
}) | ||
|
||
function isObject(obj) { | ||
return typeof obj === 'object' && obj !== null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const eslint = require('eslint') | ||
|
||
test('load config in eslint to validate all rule syntax is correct', () => { | ||
const CLIEngine = eslint.CLIEngine | ||
|
||
const cli = new CLIEngine({ | ||
useEslintrc: false, | ||
configFile: 'index.js' | ||
}) | ||
|
||
const code = 'const foo = 1\nconst bar = function () {}\nbar(foo)\n' | ||
|
||
expect(cli.executeOnText(code).errorCount).toEqual(0) | ||
}) |