diff --git a/docs/rules/sort-comp.md b/docs/rules/sort-comp.md index d2933b269b..d0b26486c6 100644 --- a/docs/rules/sort-comp.md +++ b/docs/rules/sort-comp.md @@ -54,7 +54,6 @@ The default configuration is: ```js { order: [ - 'static-variables', 'static-methods', 'lifecycle', 'everything-else', @@ -91,7 +90,7 @@ The default configuration is: } } ``` -* `static-variables` is a special keyword that refers to static class variables. +* `static-variables` This group is not specified by default, but can be used to enforce class static variable positioning. * `static-methods` is a special keyword that refers to static class methods. * `lifecycle` refers to the `lifecycle` group defined in `groups`. * `everything-else` is a special group that matches all of the methods that do not match any of the other groups. diff --git a/lib/rules/sort-comp.js b/lib/rules/sort-comp.js index cf85893814..752a53bd38 100644 --- a/lib/rules/sort-comp.js +++ b/lib/rules/sort-comp.js @@ -15,7 +15,6 @@ const docsUrl = require('../util/docsUrl'); const defaultConfig = { order: [ - 'static-variables', 'static-methods', 'lifecycle', 'everything-else', diff --git a/tests/lib/rules/sort-comp.js b/tests/lib/rules/sort-comp.js index 8344f2175a..d30bb25f48 100644 --- a/tests/lib/rules/sort-comp.js +++ b/tests/lib/rules/sort-comp.js @@ -509,7 +509,7 @@ ruleTester.run('sort-comp', rule, { }, { code: ` class MyComponent extends React.Component { - static propTypes; + static foo; static getDerivedStateFromProps() {} render() { @@ -517,7 +517,13 @@ ruleTester.run('sort-comp', rule, { } } `, - parser: parsers.BABEL_ESLINT + parser: parsers.BABEL_ESLINT, + options: [{ + order: [ + 'static-variables', + 'static-methods' + ] + }] }, { code: ` class MyComponent extends React.Component { @@ -919,7 +925,13 @@ ruleTester.run('sort-comp', rule, { } `, errors: [{message: 'getDerivedStateFromProps should be placed after foo'}], - parser: parsers.BABEL_ESLINT + parser: parsers.BABEL_ESLINT, + options: [{ + order: [ + 'static-variables', + 'static-methods' + ] + }] }, { code: ` class MyComponent extends React.Component {