Skip to content

Commit ded1dd1

Browse files
authored
chore: Switch to object export style (Intellicode#299)
Update peer dependency version
1 parent a6300d8 commit ded1dd1

File tree

7 files changed

+83
-52
lines changed

7 files changed

+83
-52
lines changed

lib/rules/no-color-literals.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const styleSheet = require('../util/stylesheet');
1212
const { StyleSheets } = styleSheet;
1313
const { astHelpers } = styleSheet;
1414

15-
module.exports = Components.detect((context) => {
15+
const create = Components.detect((context) => {
1616
const styleSheets = new StyleSheets();
1717

1818
function reportColorLiterals(colorLiterals) {
@@ -55,4 +55,9 @@ module.exports = Components.detect((context) => {
5555
};
5656
});
5757

58-
module.exports.schema = [];
58+
module.exports = {
59+
meta: {
60+
schema: [],
61+
},
62+
create,
63+
};

lib/rules/no-inline-styles.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const styleSheet = require('../util/stylesheet');
1212
const { StyleSheets } = styleSheet;
1313
const { astHelpers } = styleSheet;
1414

15-
module.exports = Components.detect((context) => {
15+
const create = Components.detect((context) => {
1616
const styleSheets = new StyleSheets();
1717

1818
function reportInlineStyles(inlineStyles) {
@@ -42,4 +42,9 @@ module.exports = Components.detect((context) => {
4242
};
4343
});
4444

45-
module.exports.schema = [];
45+
module.exports = {
46+
meta: {
47+
schema: [],
48+
},
49+
create,
50+
};

lib/rules/no-raw-text.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const elementName = (node, scope) => {
2626
return identifiers.join('.');
2727
};
2828

29-
module.exports = (context) => {
29+
function create(context) {
3030
const options = context.options[0] || {};
3131

3232
const report = (node) => {
@@ -86,19 +86,24 @@ module.exports = (context) => {
8686
}
8787
},
8888
};
89-
};
90-
91-
module.exports.schema = [
92-
{
93-
type: 'object',
94-
properties: {
95-
skip: {
96-
type: 'array',
97-
items: {
98-
type: 'string',
89+
}
90+
91+
module.exports = {
92+
meta: {
93+
schema: [
94+
{
95+
type: 'object',
96+
properties: {
97+
skip: {
98+
type: 'array',
99+
items: {
100+
type: 'string',
101+
},
102+
},
99103
},
104+
additionalProperties: false,
100105
},
101-
},
102-
additionalProperties: false,
106+
],
103107
},
104-
];
108+
create,
109+
};

lib/rules/no-unused-styles.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const styleSheet = require('../util/stylesheet');
1111
const { StyleSheets } = styleSheet;
1212
const { astHelpers } = styleSheet;
1313

14-
module.exports = Components.detect((context, components) => {
14+
const create = Components.detect((context, components) => {
1515
const styleSheets = new StyleSheets();
1616
const styleReferences = new Set();
1717

@@ -62,4 +62,9 @@ module.exports = Components.detect((context, components) => {
6262
};
6363
});
6464

65-
module.exports.schema = [];
65+
module.exports = {
66+
meta: {
67+
schema: [],
68+
},
69+
create,
70+
};

lib/rules/sort-styles.js

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const {
2323
// Rule Definition
2424
//------------------------------------------------------------------------------
2525

26-
module.exports = (context) => {
26+
function create(context) {
2727
const order = context.options[0] || 'asc';
2828
const options = context.options[1] || {};
2929
const { ignoreClassNames } = options;
@@ -130,23 +130,28 @@ module.exports = (context) => {
130130
});
131131
},
132132
};
133-
};
134-
135-
module.exports.fixable = 'code';
136-
module.exports.schema = [
137-
{
138-
enum: ['asc', 'desc'],
139-
},
140-
{
141-
type: 'object',
142-
properties: {
143-
ignoreClassNames: {
144-
type: 'boolean',
133+
}
134+
135+
module.exports = {
136+
meta: {
137+
fixable: 'code',
138+
schema: [
139+
{
140+
enum: ['asc', 'desc'],
145141
},
146-
ignoreStyleProperties: {
147-
type: 'boolean',
142+
{
143+
type: 'object',
144+
properties: {
145+
ignoreClassNames: {
146+
type: 'boolean',
147+
},
148+
ignoreStyleProperties: {
149+
type: 'boolean',
150+
},
151+
},
152+
additionalProperties: false,
148153
},
149-
},
150-
additionalProperties: false,
154+
],
151155
},
152-
];
156+
create,
157+
};

lib/rules/split-platform-components.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
'use strict';
88

9-
module.exports = function (context) {
9+
function create(context) {
1010
let reactComponents = [];
1111
const androidMessage = 'Android components should be placed in android files';
1212
const iosMessage = 'IOS components should be placed in ios files';
@@ -75,17 +75,23 @@ module.exports = function (context) {
7575
reportErrors(reactComponents, filename);
7676
},
7777
};
78-
};
78+
}
7979

80-
module.exports.schema = [{
81-
type: 'object',
82-
properties: {
83-
androidPathRegex: {
84-
type: 'string',
85-
},
86-
iosPathRegex: {
87-
type: 'string',
88-
},
80+
module.exports = {
81+
meta: {
82+
fixable: 'code',
83+
schema: [{
84+
type: 'object',
85+
properties: {
86+
androidPathRegex: {
87+
type: 'string',
88+
},
89+
iosPathRegex: {
90+
type: 'string',
91+
},
92+
},
93+
additionalProperties: false,
94+
}],
8995
},
90-
additionalProperties: false,
91-
}];
96+
create,
97+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"typescript": "^3.6.4"
3737
},
3838
"peerDependencies": {
39-
"eslint": "^3.17.0 || ^4 || ^5 || ^6 || ^7"
39+
"eslint": "^3.17.0 || ^4 || ^5 || ^6 || ^7 || ^8"
4040
},
4141
"keywords": [
4242
"eslint",

0 commit comments

Comments
 (0)