Skip to content

Commit

Permalink
[fix]sort-comp: remove static-variables from the default config and…
Browse files Browse the repository at this point in the history
… update tests, docs accordingly
  • Loading branch information
vedadeepta committed Sep 11, 2019
1 parent 0fac5c2 commit 5ab62a6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 1 addition & 2 deletions docs/rules/sort-comp.md
Expand Up @@ -54,7 +54,6 @@ The default configuration is:
```js
{
order: [
'static-variables',
'static-methods',
'lifecycle',
'everything-else',
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion lib/rules/sort-comp.js
Expand Up @@ -15,7 +15,6 @@ const docsUrl = require('../util/docsUrl');

const defaultConfig = {
order: [
'static-variables',
'static-methods',
'lifecycle',
'everything-else',
Expand Down
18 changes: 15 additions & 3 deletions tests/lib/rules/sort-comp.js
Expand Up @@ -509,15 +509,21 @@ ruleTester.run('sort-comp', rule, {
}, {
code: `
class MyComponent extends React.Component {
static propTypes;
static foo;
static getDerivedStateFromProps() {}
render() {
return null;
}
}
`,
parser: parsers.BABEL_ESLINT
parser: parsers.BABEL_ESLINT,
options: [{
order: [
'static-variables',
'static-methods'
]
}]
}, {
code: `
class MyComponent extends React.Component {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 5ab62a6

Please sign in to comment.