Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch rules to object export style (fixes eslint v8+) #299

Merged
merged 1 commit into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/rules/no-color-literals.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const styleSheet = require('../util/stylesheet');
const { StyleSheets } = styleSheet;
const { astHelpers } = styleSheet;

module.exports = Components.detect((context) => {
const create = Components.detect((context) => {
const styleSheets = new StyleSheets();

function reportColorLiterals(colorLiterals) {
Expand Down Expand Up @@ -55,4 +55,9 @@ module.exports = Components.detect((context) => {
};
});

module.exports.schema = [];
module.exports = {
meta: {
schema: [],
},
create,
};
9 changes: 7 additions & 2 deletions lib/rules/no-inline-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const styleSheet = require('../util/stylesheet');
const { StyleSheets } = styleSheet;
const { astHelpers } = styleSheet;

module.exports = Components.detect((context) => {
const create = Components.detect((context) => {
const styleSheets = new StyleSheets();

function reportInlineStyles(inlineStyles) {
Expand Down Expand Up @@ -42,4 +42,9 @@ module.exports = Components.detect((context) => {
};
});

module.exports.schema = [];
module.exports = {
meta: {
schema: [],
},
create,
};
33 changes: 19 additions & 14 deletions lib/rules/no-raw-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const elementName = (node, scope) => {
return identifiers.join('.');
};

module.exports = (context) => {
function create(context) {
const options = context.options[0] || {};

const report = (node) => {
Expand Down Expand Up @@ -86,19 +86,24 @@ module.exports = (context) => {
}
},
};
};

module.exports.schema = [
{
type: 'object',
properties: {
skip: {
type: 'array',
items: {
type: 'string',
}

module.exports = {
meta: {
schema: [
{
type: 'object',
properties: {
skip: {
type: 'array',
items: {
type: 'string',
},
},
},
additionalProperties: false,
},
},
additionalProperties: false,
],
},
];
create,
};
9 changes: 7 additions & 2 deletions lib/rules/no-unused-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const styleSheet = require('../util/stylesheet');
const { StyleSheets } = styleSheet;
const { astHelpers } = styleSheet;

module.exports = Components.detect((context, components) => {
const create = Components.detect((context, components) => {
const styleSheets = new StyleSheets();
const styleReferences = new Set();

Expand Down Expand Up @@ -62,4 +62,9 @@ module.exports = Components.detect((context, components) => {
};
});

module.exports.schema = [];
module.exports = {
meta: {
schema: [],
},
create,
};
41 changes: 23 additions & 18 deletions lib/rules/sort-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const {
// Rule Definition
//------------------------------------------------------------------------------

module.exports = (context) => {
function create(context) {
const order = context.options[0] || 'asc';
const options = context.options[1] || {};
const { ignoreClassNames } = options;
Expand Down Expand Up @@ -130,23 +130,28 @@ module.exports = (context) => {
});
},
};
};

module.exports.fixable = 'code';
module.exports.schema = [
{
enum: ['asc', 'desc'],
},
{
type: 'object',
properties: {
ignoreClassNames: {
type: 'boolean',
}

module.exports = {
meta: {
fixable: 'code',
schema: [
{
enum: ['asc', 'desc'],
},
ignoreStyleProperties: {
type: 'boolean',
{
type: 'object',
properties: {
ignoreClassNames: {
type: 'boolean',
},
ignoreStyleProperties: {
type: 'boolean',
},
},
additionalProperties: false,
},
},
additionalProperties: false,
],
},
];
create,
};
32 changes: 19 additions & 13 deletions lib/rules/split-platform-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

'use strict';

module.exports = function (context) {
function create(context) {
let reactComponents = [];
const androidMessage = 'Android components should be placed in android files';
const iosMessage = 'IOS components should be placed in ios files';
Expand Down Expand Up @@ -75,17 +75,23 @@ module.exports = function (context) {
reportErrors(reactComponents, filename);
},
};
};
}

module.exports.schema = [{
type: 'object',
properties: {
androidPathRegex: {
type: 'string',
},
iosPathRegex: {
type: 'string',
},
module.exports = {
meta: {
fixable: 'code',
schema: [{
type: 'object',
properties: {
androidPathRegex: {
type: 'string',
},
iosPathRegex: {
type: 'string',
},
},
additionalProperties: false,
}],
},
additionalProperties: false,
}];
create,
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"typescript": "^3.6.4"
},
"peerDependencies": {
"eslint": "^3.17.0 || ^4 || ^5 || ^6 || ^7"
"eslint": "^3.17.0 || ^4 || ^5 || ^6 || ^7 || ^8"
},
"keywords": [
"eslint",
Expand Down