Skip to content

Commit

Permalink
Обновляет ESLint до 9.0.0 (#358)
Browse files Browse the repository at this point in the history
* Bump `eslint` to `9.0.0`

* Переводит комменты

---------

Co-authored-by: Vadim Makeev <hi@pepelsbey.dev>
  • Loading branch information
firefoxic and pepelsbey committed Apr 14, 2024
1 parent 5d9b53b commit da9b879
Show file tree
Hide file tree
Showing 5 changed files with 261 additions and 194 deletions.
60 changes: 0 additions & 60 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .remarkrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Typograf.addRules([

const re = new RegExp(
`(^|\\s|${privateLabel})([а-яё]{1,3})\\. ?([а-яё]{1,3})\\.`,
'g',
'g'
);

return (
Expand Down
83 changes: 83 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
const globals = require('globals');
const js = require('@eslint/js');
const stylisticJs = require('@stylistic/eslint-plugin-js');

module.exports = [
js.configs.recommended,

// Глобальные переменные только для скриптов Node.js
{
ignores: ['src/scripts/**/*.js'],
languageOptions: {
globals: {
// Заменить на ...globals.nodeBuiltin для ESM
...globals.node,
},
},
},

// Глобальные переменные только для браузерных скриптов
{
files: ['src/scripts/**/*.js'],
languageOptions: {
globals: {
...globals.browser,
},
},
},
{
plugins: {
'@stylistic/js': stylisticJs,
},
rules: {
'camelcase': ['error', { 'properties': 'never' }],
'eqeqeq': 'error',
'no-array-constructor': 'error',
'no-empty': ['error', { 'allowEmptyCatch': true }],
'no-console': 'warn',
'no-const-assign': 'error',
'no-duplicate-imports': 'error',
'no-debugger': 'error',
'no-invalid-regexp': 'error',
'no-redeclare': ['error', { 'builtinGlobals': false }],
'no-unneeded-ternary': 'error',

// Стилистические правила из плагина
'@stylistic/js/arrow-spacing': 'error',
'@stylistic/js/block-spacing': ['error', 'always'],
'@stylistic/js/brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
'@stylistic/js/comma-dangle': ['error', {
'arrays': 'always-multiline',
'objects': 'always-multiline',
'imports': 'never',
'exports': 'never',
'functions': 'never',
}],
'@stylistic/js/comma-spacing': ['error', { 'before': false, 'after': true }],
'@stylistic/js/comma-style': ['error', 'last'],
'@stylistic/js/dot-location': ['error', 'property'],
'@stylistic/js/eol-last': 'error',
'@stylistic/js/function-call-spacing': ['error', 'never'],
'@stylistic/js/indent': ['error', 4, {
'SwitchCase': 1,
'ignoredNodes': ['TemplateLiteral *'],
}],
'@stylistic/js/keyword-spacing': 'error',
'@stylistic/js/key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }],
'@stylistic/js/linebreak-style': ['error', 'unix'],
'@stylistic/js/no-multi-spaces': 'error',
'@stylistic/js/no-whitespace-before-property': 'error',
'@stylistic/js/padded-blocks': ['error', 'never'],
'@stylistic/js/quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
'@stylistic/js/rest-spread-spacing': ['error', 'never'],
'@stylistic/js/semi': ['error', 'always'],
'@stylistic/js/semi-spacing': ['error', { 'before': false, 'after': true }],
'@stylistic/js/space-infix-ops': ['error', { 'int32Hint': false }],
'@stylistic/js/space-before-function-paren': ['error', 'never'],
'@stylistic/js/space-before-blocks': ['error', 'always'],
'@stylistic/js/space-in-parens': ['error', 'never'],
'@stylistic/js/spaced-comment': 'error',
'@stylistic/js/template-curly-spacing': ['error', 'never'],
},
},
];
Loading

0 comments on commit da9b879

Please sign in to comment.