Skip to content
Permalink
Browse files

fix(eslint-plugin): handle missing message IDs in eslint v5/v6 (#2461)

  • Loading branch information
esetnik committed Sep 1, 2020
1 parent 46ad4d0 commit ffdfade106d602bcc12b074bdfa489e9f661491e
@@ -97,7 +97,10 @@ export default util.createRule<Options, MessageIds>({
},
fixable: 'whitespace',
schema: baseRule.meta.schema,
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
wrongIndentation:
'Expected indentation of {{expected}} but found {{actual}}.',
},
},
defaultOptions: [
// typescript docs and playground use 4 space indent
@@ -24,7 +24,12 @@ export default createRule<Options, MessageIds>({
extendsBaseRule: true,
},
schema: baseRule.meta.schema,
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
initialized:
"Variable '{{idName}}' should be initialized on declaration.",
notInitialized:
"Variable '{{idName}}' should not be initialized on declaration.",
},
},
defaultOptions: ['always'],
create(context) {
@@ -17,7 +17,12 @@ export default util.createRule<Options, MessageIds>({
},
fixable: 'whitespace',
schema: baseRule.meta.schema,
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
expectedBefore: 'Expected space(s) before "{{value}}".',
expectedAfter: 'Expected space(s) after "{{value}}".',
unexpectedBefore: 'Unexpected space(s) before "{{value}}".',
unexpectedAfter: 'Unexpected space(s) after "{{value}}".',
},
},
defaultOptions: [{}],

@@ -32,7 +32,10 @@ export default util.createRule<Options, MessageIds>({
},
fixable: 'whitespace',
schema,
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
never: 'Unexpected blank line between class members.',
always: 'Expected blank line between class members.',
},
},
defaultOptions: [
'always',
@@ -23,7 +23,9 @@ export default createRule<Options, MessageIds>({
recommended: false,
extendsBaseRule: true,
},
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
unexpectedThis: "Unexpected 'this'.",
},
schema: baseRule.meta.schema,
},
defaultOptions: [{ capIsConstructor: true }],
@@ -40,7 +40,10 @@ export default util.createRule<Options, MessageIds>({
},
},
],
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
useConst: "Number constants declarations must use 'const'.",
noMagic: 'No magic number: {{raw}}.',
},
},
defaultOptions: [
{
@@ -19,7 +19,10 @@ export default util.createRule<Options, MessageIds>({
extendsBaseRule: true,
},
schema: baseRule.meta.schema,
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
unusedExpression:
'Expected an assignment or function call and instead saw an expression.',
},
},
defaultOptions: [
{
@@ -21,7 +21,9 @@ export default util.createRule<Options, MessageIds>({
extendsBaseRule: true,
},
schema: baseRule.meta.schema,
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
unusedVar: "'{{varName}}' is {{action}} but never used{{additional}}.",
},
},
defaultOptions: [{}],
create(context) {
@@ -54,7 +54,9 @@ export default util.createRule<Options, MessageIds>({
extendsBaseRule: true,
},
schema: baseRule.meta.schema,
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
noUselessConstructor: 'Useless constructor.',
},
},
defaultOptions: [],
create(context) {
@@ -20,7 +20,9 @@ export default util.createRule<Options, MessageIds>({
extendsBaseRule: true,
},
fixable: 'code',
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
wrongQuotes: 'Strings must use {{description}}.',
},
schema: baseRule.meta.schema,
},
defaultOptions: [
@@ -22,7 +22,10 @@ export default util.createRule<Options, MessageIds>({
},
fixable: 'code',
schema: baseRule.meta.schema,
messages: baseRule.meta.messages,
messages: baseRule.meta.messages ?? {
missingSemi: 'Missing semicolon.',
extraSemi: 'Extra semicolon.',
},
},
defaultOptions: [
'always',

0 comments on commit ffdfade

Please sign in to comment.
You can’t perform that action at this time.