eslint-plugin-putout 20.0.0 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,9 +13,7 @@ module.exports.fix = ({text}) => {
13
13
  .replace(', }', '}');
14
14
  };
15
15
 
16
- // can't use because of an error
17
- // ':has(ArrowFunctionExpression, FunctionExpression, FunctionDeclaration) > .params[type=ObjectPattern]'
18
- // Error: Unknown node type JSXElement
16
+ // can't use because of an error// ':has(ArrowFunctionExpression, FunctionExpression, FunctionDeclaration) > .params[type=ObjectPattern]'// Error: Unknown node type JSXElement
19
17
  module.exports.include = () => [
20
18
  'ArrowFunctionExpression > .params[type=ObjectPattern]',
21
19
  'FunctionExpression > .params[type=ObjectPattern]',
package/lib/index.js CHANGED
@@ -51,6 +51,7 @@ module.exports.rules = {
51
51
  ...getRule('remove-empty-newline-after-import'),
52
52
  ...getRule('remove-empty-newline-between-declarations'),
53
53
  };
54
+
54
55
  const config = require('@putout/eslint-config');
55
56
  const {rules} = config;
56
57
 
package/lib/json.js CHANGED
@@ -6,31 +6,31 @@ module.exports = [{
6
6
  '*{json}',
7
7
  ],
8
8
  rules: {
9
- 'quotes': [
9
+ 'no-undef': 'off',
10
+ '@stylistic/js/quotes': [
10
11
  'error',
11
12
  'double',
12
13
  ],
13
- 'quote-props': [
14
+ '@stylistic/js/quote-props': [
14
15
  'error',
15
16
  'always',
16
17
  ],
17
- 'comma-dangle': [
18
+ '@stylistic/js/comma-dangle': [
18
19
  'error',
19
20
  'never',
20
21
  ],
21
- 'comma-spacing': 'off',
22
- 'function-paren-newline': 'off',
23
- 'no-undef': 'off',
24
- 'eol-last': [
22
+ '@stylistic/js/comma-spacing': 'off',
23
+ '@stylistic/js/function-paren-newline': 'off',
24
+ '@stylistic/js/eol-last': [
25
25
  'error',
26
26
  'always',
27
27
  ],
28
- 'no-multi-spaces': 'off',
28
+ '@stylistic/js/no-multi-spaces': 'off',
29
29
  },
30
30
  }, {
31
31
  files: 'package.json',
32
32
  rules: {
33
- indent: [
33
+ '@stylistic/js/indent': [
34
34
  'error',
35
35
  2,
36
36
  ],
@@ -38,11 +38,11 @@ module.exports = [{
38
38
  }, {
39
39
  files: '*ignore{json}',
40
40
  rules: {
41
- 'comma-dangle': 'off',
41
+ '@stylistic/js/comma-dangle': 'off',
42
42
  },
43
43
  }, {
44
44
  files: '*.yml{json}',
45
45
  rules: {
46
- indent: 'off',
46
+ '@stylistic/js/indent': 'off',
47
47
  },
48
48
  }];
package/lib/jsx.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const jsx = {
4
4
  rules: {
5
- 'no-extra-parens': 'off',
5
+ '@stylistic/js/no-extra-parens': 'off',
6
6
  'react/jsx-indent': 'error',
7
7
  'react/jsx-wrap-multilines': ['error', {
8
8
  arrow: 'parens-new-line',
package/lib/markdown.js CHANGED
@@ -6,12 +6,12 @@ const [ts, tsx] = require('./ts');
6
6
  const {jsx} = require('./jsx');
7
7
 
8
8
  const commonRules = {
9
- 'no-undef': 'off',
10
- 'no-empty': 'off',
11
- 'eol-last': [
9
+ '@stylistic/js/eol-last': [
12
10
  'error',
13
11
  'never',
14
12
  ],
13
+ 'no-undef': 'off',
14
+ 'no-empty': 'off',
15
15
  'no-unreachable': 'off',
16
16
  'no-constant-condition': 'off',
17
17
  'n/no-extraneous-require': 'off',
@@ -82,7 +82,7 @@ module.exports = [{
82
82
  }, {
83
83
  files: '*.md{json}',
84
84
  rules: {
85
- 'eol-last': [
85
+ '@stylistic/js/eol-last': [
86
86
  'error',
87
87
  'never',
88
88
  ],
@@ -15,7 +15,6 @@ const parseOptions = require('putout/parse-options');
15
15
  const {parseError} = require('../parse-error');
16
16
 
17
17
  const cwd = process.cwd();
18
-
19
18
  const EMPTY_VISITORS = {};
20
19
 
21
20
  module.exports = ({context, options}) => {
@@ -78,7 +77,6 @@ module.exports = ({context, options}) => {
78
77
 
79
78
  const fix = ({ast, text, node, source, resultOptions}) => (fixer) => {
80
79
  const includeComments = true;
81
-
82
80
  const lastToken = source.getLastToken(node, {
83
81
  includeComments,
84
82
  });
@@ -86,7 +84,6 @@ const fix = ({ast, text, node, source, resultOptions}) => (fixer) => {
86
84
  transform(ast, text, resultOptions);
87
85
 
88
86
  const [, last] = lastToken.range;
89
-
90
87
  const code = print(ast);
91
88
 
92
89
  return fixer.replaceTextRange([0, last], code);
package/lib/ts.js CHANGED
@@ -3,56 +3,44 @@
3
3
  const {rules} = require('@putout/eslint-config');
4
4
  const jsx = require('./jsx');
5
5
 
6
+ const reEnable = (rule) => ({
7
+ [`@stylistic/ts/${rule}`]: 'error',
8
+ });
9
+
6
10
  const warnOnUnsupportedTypeScriptVersion = false;
7
11
 
8
12
  const extensionRules = {
9
13
  'no-undef': 'off',
10
14
  'no-var': 'off',
11
- '@typescript-eslint/brace-style': 'off', // putout/object-property-newline instead
12
- 'comma-dangle': 'off',
13
- '@typescript-eslint/comma-dangle': rules['comma-dangle'],
14
15
 
15
- 'comma-spacing': 'off',
16
- '@typescript-eslint/comma-spacing': 'error',
17
- '@typescript-eslint/dot-notation': 'off', // requires type information
18
- 'func-call-spacing': 'off',
19
- '@typescript-eslint/func-call-spacing': 'error',
20
- '@typescript-eslint/indent': 'off', // broken
21
- '@typescript-eslint/lines-between-class-members': 'off',
22
- '@typescript-eslint/no-array-constructor': 'off',
16
+ '@stylistic/ts/comma-spacing': 'error',
23
17
 
24
- 'no-extra-parens': 'off',
25
- '@typescript-eslint/no-extra-parens': 'error',
18
+ '@stylistic/ts/indent': 'off', // broken
19
+ '@stylistic/brace-style': 'off', // putout/object-property-newline instead
20
+ '@stylistic/ts/lines-between-class-members': 'off',
26
21
 
27
- 'no-extra-semi': 'off',
28
- '@typescript-eslint/no-extra-semi': 'error',
22
+ '@stylistic/js/padding-line-between-statements': 'off',
23
+ '@stylistic/ts/padding-line-between-statements': convertPaddingLines(rules['@stylistic/js/padding-line-between-statements']),
29
24
 
25
+ '@stylistic/js/semi': 'off',
26
+ '@stylistic/ts/semi': rules['@stylistic/js/semi'],
27
+
28
+ '@stylistic/js/space-before-function-paren': 'off',
29
+ '@stylistic/ts/space-before-function-paren': rules['@stylistic/js/space-before-function-paren'],
30
+
31
+ ...reEnable('object-curly-spacing'),
32
+ ...reEnable('func-call-spacing'),
33
+ '@typescript-eslint/no-array-constructor': 'off',
34
+ '@typescript-eslint/dot-notation': 'off', // requires type information
35
+ '@typescript-eslint/no-extra-parens': 'error',
30
36
  '@typescript-eslint/no-implied-eval': 'off',
31
37
 
32
38
  'no-unused-vars': 'off',
33
39
  '@typescript-eslint/no-unused-vars': 'error',
34
40
 
35
- 'object-curly-spacing': 'off',
36
- '@typescript-eslint/object-curly-spacing': 'error',
37
-
38
- 'padding-line-between-statements': 'off',
39
- '@typescript-eslint/padding-line-between-statements': convertPaddingLines(rules['padding-line-between-statements']),
40
-
41
- 'quotes': 'off',
42
- '@typescript-eslint/quotes': rules.quotes,
43
-
44
41
  '@typescript-eslint/require-await': 'off',
45
42
 
46
- 'semi': 'off',
47
- '@typescript-eslint/semi': rules.semi,
48
-
49
- 'space-before-function-paren': 'off',
50
- '@typescript-eslint/space-before-function-paren': rules['space-before-function-paren'],
51
-
52
- 'space-infix-ops': 'off',
53
- '@typescript-eslint/space-infix-ops': rules['space-infix-ops'],
54
-
55
- 'no-redecalre': 'off',
43
+ 'no-redeclare': 'off',
56
44
  '@typescript-eslint/no-redeclare': 'error',
57
45
  };
58
46
 
@@ -65,7 +53,7 @@ const ts = {
65
53
  jsx: false,
66
54
  },
67
55
  },
68
- plugins: ['@typescript-eslint'],
56
+ plugins: ['@typescript-eslint', '@stylistic/ts'],
69
57
  extends: ['plugin:@typescript-eslint/recommended'],
70
58
  rules: {
71
59
  ...extensionRules,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-putout",
3
- "version": "20.0.0",
3
+ "version": "21.0.0",
4
4
  "type": "commonjs",
5
5
  "description": "ESLint plugin for 🐊Putout",
6
6
  "release": false,
@@ -43,7 +43,8 @@
43
43
  "@eslint/eslintrc": "^2.0.2",
44
44
  "@putout/engine-parser": "^9.0.0",
45
45
  "@putout/eslint": "^2.0.0",
46
- "@putout/eslint-config": "^7.0.0",
46
+ "@putout/eslint-config": "^8.0.0",
47
+ "@stylistic/eslint-plugin": "^0.1.1",
47
48
  "@typescript-eslint/eslint-plugin": "^6.0.0",
48
49
  "@typescript-eslint/parser": "^6.0.0",
49
50
  "align-spaces": "^1.0.0",