mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-08-25 08:08:00 +00:00
1ada95e04a
- Convert project to Javascript/Typescript - Allow custom headers to be passed in (optional) - Allow body to be optional
41 lines
4.5 KiB
JavaScript
41 lines
4.5 KiB
JavaScript
'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
|
|
|
|
module.exports = {
|
|
meta: {
|
|
type: 'suggestion',
|
|
docs: {
|
|
url: (0, _docsUrl2.default)('no-default-export') },
|
|
|
|
schema: [] },
|
|
|
|
|
|
create(context) {
|
|
// ignore non-modules
|
|
if (context.parserOptions.sourceType !== 'module') {
|
|
return {};
|
|
}
|
|
|
|
const preferNamed = 'Prefer named exports.';
|
|
const noAliasDefault = (_ref) => {let local = _ref.local;return (
|
|
`Do not alias \`${local.name}\` as \`default\`. Just export ` +
|
|
`\`${local.name}\` itself instead.`);};
|
|
|
|
return {
|
|
ExportDefaultDeclaration(node) {
|
|
context.report({ node, message: preferNamed });
|
|
},
|
|
|
|
ExportNamedDeclaration(node) {
|
|
node.specifiers.forEach(specifier => {
|
|
if (specifier.type === 'ExportDefaultSpecifier' &&
|
|
specifier.exported.name === 'default') {
|
|
context.report({ node, message: preferNamed });
|
|
} else if (specifier.type === 'ExportSpecifier' &&
|
|
specifier.exported.name === 'default') {
|
|
context.report({ node, message: noAliasDefault(specifier) });
|
|
}
|
|
});
|
|
} };
|
|
|
|
} };
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1kZWZhdWx0LWV4cG9ydC5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsInBhcnNlck9wdGlvbnMiLCJzb3VyY2V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