eslint-plugin-lingui
Version:
ESLint plugin for Lingui
85 lines • 3.7 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
const noExpressionInMessageRule = __importStar(require("./rules/no-expression-in-message"));
const noUnlocalizedStringsRule = __importStar(require("./rules/no-unlocalized-strings"));
const noSingleTagToTranslateRule = __importStar(require("./rules/no-single-tag-to-translate"));
const noSingleVariablesToTranslateRule = __importStar(require("./rules/no-single-variables-to-translate"));
const tCallInFunctionRule = __importStar(require("./rules/t-call-in-function"));
const textRestrictionsRule = __importStar(require("./rules/text-restrictions"));
const noTransInsideTransRule = __importStar(require("./rules/no-trans-inside-trans"));
const consistentPluralFormatRule = __importStar(require("./rules/consistent-plural-format"));
const noPluralInsideTransRule = __importStar(require("./rules/no-plural-inside-trans"));
const requireExplicitIdRule = __importStar(require("./rules/require-explicit-id"));
const rules = {
[noExpressionInMessageRule.name]: noExpressionInMessageRule.rule,
[noUnlocalizedStringsRule.name]: noUnlocalizedStringsRule.rule,
[noSingleTagToTranslateRule.name]: noSingleTagToTranslateRule.rule,
[noSingleVariablesToTranslateRule.name]: noSingleVariablesToTranslateRule.rule,
[tCallInFunctionRule.name]: tCallInFunctionRule.rule,
[textRestrictionsRule.name]: textRestrictionsRule.rule,
[noTransInsideTransRule.name]: noTransInsideTransRule.rule,
[consistentPluralFormatRule.name]: consistentPluralFormatRule.rule,
[noPluralInsideTransRule.name]: noPluralInsideTransRule.rule,
[requireExplicitIdRule.name]: requireExplicitIdRule.rule,
};
const plugin = {
meta: {
name: 'eslint-plugin-lingui',
},
configs: {},
rules,
};
const recommendedRules = {
'lingui/t-call-in-function': 'error',
'lingui/no-single-tag-to-translate': 'warn',
'lingui/no-single-variables-to-translate': 'warn',
'lingui/no-trans-inside-trans': 'warn',
'lingui/no-expression-in-message': 'warn',
};
// Assign configs here so we can reference `plugin`
Object.assign(plugin.configs, {
recommended: {
plugins: ['lingui'],
rules: recommendedRules,
},
'flat/recommended': {
plugins: {
lingui: plugin,
},
rules: recommendedRules,
},
});
module.exports = plugin;
//# sourceMappingURL=index.js.map