mirror of
https://github.com/garraflavatra/yeslint.git
synced 2025-07-18 21:44:04 +00:00
Compare commits
7 Commits
v1.0.0
...
75ab0a8c07
Author | SHA1 | Date | |
---|---|---|---|
75ab0a8c07
|
|||
945a539178
|
|||
9055dde0ae
|
|||
b5b3ccac67
|
|||
c29b5c06cf
|
|||
ce45856c63
|
|||
88facd931e
|
10
.eslintrc.js
10
.eslintrc.js
@ -2,12 +2,18 @@
|
||||
|
||||
const svelteConfig = require('./configs/svelte.js');
|
||||
|
||||
/** @type {import('eslint').Linter.Config} */
|
||||
/**
|
||||
* Don't import this! It is the configuration for the yeslint! code and is not
|
||||
* meant to be used elsewhere. Please refer to the readme.
|
||||
*
|
||||
* @type {import('eslint').Linter.Config}
|
||||
*/
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: './configs/node.js',
|
||||
ignorePatterns: [ '/example/wrong.*' ],
|
||||
overrides: [ {
|
||||
files: [ './example/correct.svelte' ],
|
||||
files: [ './example/*.svelte' ],
|
||||
overrides: svelteConfig.overrides,
|
||||
parserOptions: svelteConfig.parserOptions,
|
||||
env: svelteConfig.env,
|
||||
|
@ -1,6 +1,6 @@
|
||||
# yeslint!
|
||||
|
||||
A sensible, modern collection of configuration files for [ESLint] that enforces beautiful code. It contains both rules to ensure correct code (e.g. enforce `break` statements in each `switch` `case`), and rules to make your code beautiful (e.g. adding a trailing comma to array items that start on a newline).
|
||||
A sensible, modern collection of configuration files for [ESLint] that enforces beautiful and correct code. It contains both rules to ensure correct code (e.g. enforce `break` statements in each `switch` `case`), and rules to make your code beautiful (e.g. adding a trailing comma to array items that start on a newline).
|
||||
|
||||
## What's included
|
||||
|
||||
@ -36,7 +36,7 @@ Please consider the following example. You should replace `<name>` with the name
|
||||
|
||||
```javascript
|
||||
module.exports = {
|
||||
extends: './node_modules/yeslint/config/<name>.js',
|
||||
extends: './node_modules/@garraflavatra/yeslint/configs/<name>.js',
|
||||
};
|
||||
```
|
||||
|
||||
@ -44,7 +44,7 @@ Or add this to your `package.json` file:
|
||||
|
||||
```json
|
||||
"eslintConfig": {
|
||||
"extends": "./node_modules/yeslint/config/<name>.js"
|
||||
"extends": "./node_modules/@garraflavatra/yeslint/configs/<name>.js"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -1,5 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
let typescriptInstalled = false;
|
||||
|
||||
try {
|
||||
require('typescript');
|
||||
typescriptInstalled = true;
|
||||
}
|
||||
catch { /* not installed */ }
|
||||
|
||||
/**
|
||||
* Generic ESLint configuration for all modern JavaScript runtimes.
|
||||
*
|
||||
@ -20,9 +28,7 @@ const generic = {
|
||||
rules: {
|
||||
'no-undef': [
|
||||
'error',
|
||||
{
|
||||
typeof: true,
|
||||
},
|
||||
{ typeof: true },
|
||||
],
|
||||
'require-atomic-updates': 0,
|
||||
indent: [
|
||||
@ -47,11 +53,7 @@ const generic = {
|
||||
'error',
|
||||
'always',
|
||||
],
|
||||
'array-element-newline': [ 'warn' ],
|
||||
'array-bracket-newline': [
|
||||
'warn',
|
||||
{ minItems: 2 },
|
||||
],
|
||||
'array-element-newline': 'off',
|
||||
'arrow-body-style': [
|
||||
'error',
|
||||
'as-needed',
|
||||
@ -92,9 +94,7 @@ const generic = {
|
||||
'keyword-spacing': 'error',
|
||||
'key-spacing': [
|
||||
'warn',
|
||||
{
|
||||
beforeColon: false,
|
||||
},
|
||||
{ beforeColon: false },
|
||||
],
|
||||
'linebreak-style': [
|
||||
'error',
|
||||
@ -194,7 +194,7 @@ const generic = {
|
||||
'space-infix-ops': 'error',
|
||||
'space-unary-ops': 'error',
|
||||
'template-curly-spacing': 'error',
|
||||
curly: 2,
|
||||
curly: 'error',
|
||||
'brace-style': [
|
||||
'error',
|
||||
'stroustrup',
|
||||
@ -211,6 +211,12 @@ const generic = {
|
||||
'no-nested-ternary': 'error',
|
||||
'no-lonely-if': 'error',
|
||||
},
|
||||
overrides: typescriptInstalled ? [ {
|
||||
files: '**/*.ts',
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [ '@typescript-eslint' ],
|
||||
extends: [ 'plugin:@typescript-eslint/recommended' ],
|
||||
} ] : [],
|
||||
};
|
||||
|
||||
module.exports = generic;
|
||||
|
@ -36,6 +36,13 @@ const svelte = {
|
||||
parser: 'svelte-eslint-parser',
|
||||
rules: {
|
||||
'no-inner-declarations': 0,
|
||||
'max-len': [
|
||||
'warn',
|
||||
{
|
||||
...generic.rules['max-len'][1],
|
||||
code: 200,
|
||||
},
|
||||
],
|
||||
'svelte/no-inner-declarations': [
|
||||
'error',
|
||||
'functions',
|
||||
|
@ -11,4 +11,10 @@ module.exports = {
|
||||
console.log(password);
|
||||
},
|
||||
],
|
||||
|
||||
arrays: [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
],
|
||||
};
|
||||
|
@ -5,5 +5,7 @@ module.exports = {
|
||||
|
||||
object:{spacing:'required!'},
|
||||
|
||||
functions: [( env )=> console.log(env.password),function ({password}) { console.log( password )}]
|
||||
functions: [( env )=> console.log(env.password),function ({password}) { console.log( password )}],
|
||||
|
||||
arrays: [1,2,3]
|
||||
}
|
||||
|
960
package-lock.json
generated
960
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -27,12 +27,24 @@
|
||||
"eslint-plugin-import": "^2.27.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
||||
"@typescript-eslint/parser": "^6.2.1",
|
||||
"eslint": "^7.9.0 || ^8.0.0",
|
||||
"eslint-plugin-svelte": "^2.32.4"
|
||||
"eslint-plugin-svelte": "^2.32.4",
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@typescript-eslint/parser": {
|
||||
"optional": true
|
||||
},
|
||||
"@typescript-eslint/eslint-plugin": {
|
||||
"optional": true
|
||||
},
|
||||
"eslint-plugin-svelte": {
|
||||
"optional": true
|
||||
},
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
|
Reference in New Issue
Block a user