eslint-config-metarhia
Advanced tools
Comparing version 8.2.2 to 9.0.0
44
index.js
'use strict'; | ||
const rules = [ | ||
'./rules/possible-errors', | ||
'./rules/best-practices', | ||
'./rules/strict-mode', | ||
'./rules/variables', | ||
'./rules/nodejs-and-commonjs', | ||
'./rules/stylistic-issues', | ||
'./rules/ecmascript-6', | ||
'./rules/plugin-import', | ||
'./rules/parser-options', | ||
'./rules/ecmascript-13', | ||
].map(require.resolve); | ||
const { recommended } = require('@eslint/js').configs; | ||
module.exports = { | ||
extends: ['eslint:recommended', ...rules], | ||
const metarhia = { | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'commonjs', | ||
globals: { | ||
BigInt: true, | ||
}, | ||
}, | ||
ignores: ['node_modules/*'], | ||
rules: {}, | ||
}; | ||
const files = [ | ||
'./rules/possible-errors.js', | ||
'./rules/best-practices.js', | ||
'./rules/strict-mode.js', | ||
'./rules/variables.js', | ||
'./rules/nodejs-and-commonjs.js', | ||
'./rules/stylistic-issues.js', | ||
'./rules/ecmascript-6.js', | ||
'./rules/ecmascript-13.js', | ||
]; | ||
const sections = files.map(require); | ||
for (const section of sections) { | ||
Object.assign(metarhia.rules, section); | ||
} | ||
module.exports = [recommended, metarhia]; |
{ | ||
"name": "eslint-config-metarhia", | ||
"version": "8.2.2", | ||
"version": "9.0.0", | ||
"author": "Alexey Orlenko <eaglexrlnk@gmail.com>", | ||
@@ -19,3 +19,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": "16 || 18 || 20 || 21" | ||
"node": "20 || 21 || 22" | ||
}, | ||
@@ -40,12 +40,7 @@ "repository": { | ||
"devDependencies": { | ||
"eslint": "^8.55.0", | ||
"eslint": "^9.9.0", | ||
"prettier": "^3.1.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.29.0", | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"prettier": "^3.1.0" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^8.45.0", | ||
"eslint-plugin-import": "^2.27.5" | ||
"eslint-plugin-prettier": "^5.1.3" | ||
} | ||
} |
# eslint-config-metarhia | ||
[![Build Status][travis-badge]][travis-url] | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/metarhia/eslint-config-metarhia.svg)](https://greenkeeper.io/) | ||
Opinionated [ESLint](https://eslint.org/) config and de-facto JavaScript | ||
styleguide for [Metarhia](https://github.com/metarhia/) projects. | ||
Opinionated [ESLint][] config and de-facto JavaScript styleguide for | ||
[Metarhia][] projects. | ||
[![ci status](https://github.com/metarhia/eslint-config-metarhia/workflows/Testing%20CI/badge.svg)](https://github.com/metarhia/eslint-config-metarhia/actions?query=workflow%3A%22Testing+CI%22+branch%3Amaster) | ||
[![snyk](https://snyk.io/test/github/metarhia/eslint-config-metarhia/badge.svg)](https://snyk.io/test/github/metarhia/eslint-config-metarhia) | ||
[![npm version](https://badge.fury.io/js/eslint-config-metarhia.svg)](https://badge.fury.io/js/eslint-config-metarhia) | ||
[![npm downloads/month](https://img.shields.io/npm/dm/eslint-config-metarhia.svg)](https://www.npmjs.com/package/eslint-config-metarhia) | ||
[![npm downloads](https://img.shields.io/npm/dt/eslint-config-metarhia.svg)](https://www.npmjs.com/package/eslint-config-metarhia) | ||
## Usage | ||
1. Install ESLint, this config and required plugins: | ||
1. Install ESLint and this config: | ||
```console | ||
npm i -D eslint eslint-plugin-import eslint-config-metarhia | ||
``` | ||
```console | ||
npm i -D eslint eslint-config-metarhia | ||
``` | ||
2. Add `"extends": "metarhia"` to your `.eslintrc`. | ||
2. Import `eslint-config-metarhia` in `.eslint.config.js`, add additional rules, | ||
export everything together. | ||
## Contributing | ||
```js | ||
const config = require('eslint-config-metarhia'); | ||
Please adhere to [Conventional Commits][] styleguide for commit messages | ||
(`npm install` creates a Git hook that lints your commit messages, and they are | ||
also checked on CI, but please write them properly beforehand so that they don't | ||
get rejected. If that happens locally while committing, though, don't worry, | ||
your commit message isn't lost, you can still find it in `.git/COMMIT_EDITMSG`). | ||
### Releasing | ||
Collaborators can release new versions using | ||
```console | ||
npm run release | ||
git push origin master --follow-tags | ||
npm publish | ||
module.exports = [ | ||
config, | ||
{ | ||
rules: { | ||
'no-unused-vars': 'warn', | ||
}, | ||
}, | ||
]; | ||
``` | ||
This will update the version in `package.json` and `package-lock.json` | ||
according to semantic versioning using commit messages to determine whether it | ||
is a patch, minor or major release, update the changelog, tag the new version | ||
in Git, and publish it to npm registry. | ||
## License | ||
MIT. See the [LICENSE][] file for details. | ||
[conventional commits]: https://conventionalcommits.org/ | ||
[eslint]: https://eslint.org/ | ||
[license]: LICENSE | ||
[metarhia]: https://github.com/metarhia | ||
[travis-badge]: https://travis-ci.org/metarhia/eslint-config-metarhia.svg?branch=master | ||
[travis-url]: https://travis-ci.org/metarhia/eslint-config-metarhia | ||
Copyright (c) 2017-2024 [Metarhia contributors](https://github.com/metarhia/eslint-config-metarhia/graphs/contributors). | ||
eslint-config-metarhia is [MIT licensed](./LICENSE).\ | ||
eslint-config-metarhia is a part of [Metarhia](https://github.com/metarhia) technology stack. |
'use strict'; | ||
module.exports = { | ||
rules: { | ||
eqeqeq: ['error', 'always'], | ||
'no-loop-func': ['error'], | ||
'no-self-compare': ['error'], | ||
'no-unmodified-loop-condition': ['error'], | ||
'no-useless-concat': ['error'], | ||
curly: ['error', 'multi-line', 'consistent'], | ||
'consistent-return': ['error', { treatUndefinedAsUnspecified: true }], | ||
}, | ||
eqeqeq: ['error', 'always'], | ||
'no-loop-func': ['error'], | ||
'no-self-compare': ['error'], | ||
'no-unmodified-loop-condition': ['error'], | ||
'no-useless-concat': ['error'], | ||
curly: ['error', 'multi-line', 'consistent'], | ||
'consistent-return': ['error', { treatUndefinedAsUnspecified: true }], | ||
}; |
'use strict'; | ||
module.exports = { | ||
rules: { | ||
'no-unused-private-class-members': ['error'], | ||
'no-invalid-this': ['error'], | ||
'class-methods-use-this': ['warn'], | ||
}, | ||
'no-unused-private-class-members': ['error'], | ||
'no-invalid-this': ['error'], | ||
'class-methods-use-this': ['warn'], | ||
}; |
'use strict'; | ||
module.exports = { | ||
env: { | ||
es6: true, | ||
}, | ||
rules: { | ||
'arrow-body-style': ['error', 'as-needed'], | ||
'arrow-parens': ['error', 'always'], | ||
'arrow-spacing': ['error'], | ||
'no-useless-computed-key': ['error'], | ||
'no-useless-rename': ['error'], | ||
'no-var': ['error'], | ||
'object-shorthand': ['error', 'always'], | ||
'prefer-arrow-callback': ['error'], | ||
'prefer-const': ['error'], | ||
'prefer-numeric-literals': ['error'], | ||
'prefer-rest-params': ['error'], | ||
'prefer-spread': ['error'], | ||
'rest-spread-spacing': ['error', 'never'], | ||
'template-curly-spacing': ['error', 'never'], | ||
}, | ||
'arrow-body-style': ['error', 'as-needed'], | ||
'arrow-parens': ['error', 'always'], | ||
'arrow-spacing': ['error'], | ||
'no-useless-computed-key': ['error'], | ||
'no-useless-rename': ['error'], | ||
'no-var': ['error'], | ||
'object-shorthand': ['error', 'always'], | ||
'prefer-arrow-callback': ['error'], | ||
'prefer-const': ['error'], | ||
'prefer-numeric-literals': ['error'], | ||
'prefer-rest-params': ['error'], | ||
'prefer-spread': ['error'], | ||
'rest-spread-spacing': ['error', 'never'], | ||
'template-curly-spacing': ['error', 'never'], | ||
}; |
'use strict'; | ||
module.exports = { | ||
env: { | ||
node: true, | ||
}, | ||
rules: { | ||
'handle-callback-err': ['error', '^err'], | ||
}, | ||
'handle-callback-err': ['error', '^err'], | ||
}; |
'use strict'; | ||
module.exports = { | ||
rules: { | ||
'no-console': ['off'], | ||
'no-constant-condition': [ | ||
'error', | ||
{ | ||
checkLoops: false, | ||
}, | ||
], | ||
'no-return-assign': ['error'], | ||
}, | ||
'no-console': ['off'], | ||
'no-constant-condition': [ | ||
'error', | ||
{ | ||
checkLoops: false, | ||
}, | ||
], | ||
'no-return-assign': ['error'], | ||
}; |
'use strict'; | ||
module.exports = { | ||
rules: { | ||
strict: ['error', 'global'], | ||
}, | ||
strict: ['error', 'global'], | ||
}; |
'use strict'; | ||
module.exports = { | ||
rules: { | ||
indent: [ | ||
'error', | ||
2, | ||
{ | ||
SwitchCase: 1, | ||
VariableDeclarator: { | ||
let: 2, | ||
const: 3, | ||
}, | ||
MemberExpression: 1, | ||
indent: [ | ||
'error', | ||
2, | ||
{ | ||
SwitchCase: 1, | ||
VariableDeclarator: { | ||
let: 2, | ||
const: 3, | ||
}, | ||
], | ||
'block-spacing': ['error', 'always'], | ||
'brace-style': [ | ||
'error', | ||
'1tbs', | ||
{ | ||
allowSingleLine: true, | ||
}, | ||
], | ||
camelcase: ['error'], | ||
'comma-dangle': ['error', 'always-multiline'], | ||
'comma-spacing': [ | ||
'error', | ||
{ | ||
before: false, | ||
after: true, | ||
}, | ||
], | ||
'comma-style': ['error', 'last'], | ||
'eol-last': ['error'], | ||
'func-call-spacing': ['error', 'never'], | ||
'key-spacing': [ | ||
'error', | ||
{ | ||
beforeColon: false, | ||
afterColon: true, | ||
mode: 'minimum', | ||
}, | ||
], | ||
'keyword-spacing': [ | ||
'error', | ||
{ | ||
before: true, | ||
after: true, | ||
overrides: { | ||
function: { | ||
after: false, | ||
}, | ||
MemberExpression: 1, | ||
}, | ||
], | ||
'block-spacing': ['error', 'always'], | ||
'brace-style': [ | ||
'error', | ||
'1tbs', | ||
{ | ||
allowSingleLine: true, | ||
}, | ||
], | ||
camelcase: ['error'], | ||
'comma-dangle': ['error', 'always-multiline'], | ||
'comma-spacing': [ | ||
'error', | ||
{ | ||
before: false, | ||
after: true, | ||
}, | ||
], | ||
'comma-style': ['error', 'last'], | ||
'eol-last': ['error'], | ||
'func-call-spacing': ['error', 'never'], | ||
'key-spacing': [ | ||
'error', | ||
{ | ||
beforeColon: false, | ||
afterColon: true, | ||
mode: 'minimum', | ||
}, | ||
], | ||
'keyword-spacing': [ | ||
'error', | ||
{ | ||
before: true, | ||
after: true, | ||
overrides: { | ||
function: { | ||
after: false, | ||
}, | ||
}, | ||
], | ||
'linebreak-style': ['error', 'unix'], | ||
'max-len': [ | ||
'error', | ||
{ | ||
code: 80, | ||
ignoreUrls: true, | ||
}, | ||
], | ||
'linebreak-style': ['error', 'unix'], | ||
'max-len': [ | ||
'error', | ||
{ | ||
code: 80, | ||
ignoreUrls: true, | ||
}, | ||
], | ||
'max-nested-callbacks': [ | ||
'error', | ||
{ | ||
max: 5, | ||
}, | ||
], | ||
'new-cap': [ | ||
'error', | ||
{ | ||
newIsCap: true, | ||
capIsNew: true, | ||
properties: true, | ||
}, | ||
], | ||
'new-parens': ['error'], | ||
'no-lonely-if': ['error'], | ||
'no-trailing-spaces': ['error'], | ||
'no-unneeded-ternary': ['error'], | ||
'no-nested-ternary': ['error'], | ||
'no-whitespace-before-property': ['error'], | ||
'object-curly-spacing': ['error', 'always'], | ||
'operator-assignment': ['error', 'always'], | ||
'operator-linebreak': [ | ||
'error', | ||
'after', | ||
{ overrides: { '?': 'before', ':': 'before' } }, | ||
], | ||
quotes: [ | ||
'error', | ||
'single', | ||
{ | ||
allowTemplateLiterals: true, | ||
}, | ||
], | ||
semi: ['error', 'always'], | ||
'semi-spacing': [ | ||
'error', | ||
{ | ||
before: false, | ||
after: true, | ||
}, | ||
], | ||
'space-before-blocks': ['error', 'always'], | ||
'space-before-function-paren': [ | ||
'error', | ||
{ | ||
anonymous: 'never', | ||
named: 'never', | ||
asyncArrow: 'always', | ||
}, | ||
], | ||
'space-in-parens': ['error', 'never'], | ||
'space-infix-ops': ['error'], | ||
'space-unary-ops': [ | ||
'error', | ||
{ | ||
words: true, | ||
nonwords: false, | ||
overrides: { | ||
typeof: false, | ||
}, | ||
], | ||
'max-nested-callbacks': [ | ||
'error', | ||
{ | ||
max: 5, | ||
}, | ||
], | ||
'new-cap': [ | ||
'error', | ||
{ | ||
newIsCap: true, | ||
capIsNew: true, | ||
properties: true, | ||
}, | ||
], | ||
'new-parens': ['error'], | ||
'no-lonely-if': ['error'], | ||
'no-trailing-spaces': ['error'], | ||
'no-unneeded-ternary': ['error'], | ||
'no-nested-ternary': ['error'], | ||
'no-whitespace-before-property': ['error'], | ||
'object-curly-spacing': ['error', 'always'], | ||
'operator-assignment': ['error', 'always'], | ||
'operator-linebreak': [ | ||
'error', | ||
'after', | ||
{ overrides: { '?': 'before', ':': 'before' } }, | ||
], | ||
quotes: [ | ||
'error', | ||
'single', | ||
{ | ||
allowTemplateLiterals: true, | ||
}, | ||
], | ||
semi: ['error', 'always'], | ||
'semi-spacing': [ | ||
'error', | ||
{ | ||
before: false, | ||
after: true, | ||
}, | ||
], | ||
'space-before-blocks': ['error', 'always'], | ||
'space-before-function-paren': [ | ||
'error', | ||
{ | ||
anonymous: 'never', | ||
named: 'never', | ||
asyncArrow: 'always', | ||
}, | ||
], | ||
'space-in-parens': ['error', 'never'], | ||
'space-infix-ops': ['error'], | ||
'space-unary-ops': [ | ||
'error', | ||
{ | ||
words: true, | ||
nonwords: false, | ||
overrides: { | ||
typeof: false, | ||
}, | ||
}, | ||
], | ||
'no-extra-parens': [ | ||
'error', | ||
'all', | ||
{ | ||
returnAssign: false, | ||
nestedBinaryExpressions: false, | ||
enforceForArrowConditionals: false, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
'no-extra-parens': [ | ||
'error', | ||
'all', | ||
{ | ||
returnAssign: false, | ||
nestedBinaryExpressions: false, | ||
enforceForArrowConditionals: false, | ||
}, | ||
], | ||
}; |
'use strict'; | ||
module.exports = { | ||
rules: { | ||
'no-shadow-restricted-names': ['error'], | ||
'no-use-before-define': [ | ||
'error', | ||
{ | ||
functions: false, | ||
}, | ||
], | ||
}, | ||
'no-shadow-restricted-names': ['error'], | ||
'no-use-before-define': [ | ||
'error', | ||
{ | ||
functions: false, | ||
}, | ||
], | ||
}; |
Sorry, the diff of this file is not supported yet
0
4
8480
12
225
41