ESLint needs Template's names in camel-case

Hi,

I am using ESLint as recommanded in the Meteor 1.3 guide, and I have a template named ‘Home_page’.
When using Template.Home_page.helpers({ ESLint is giving me the following error: Invalid template name, expected name to be in camel-case.

In the Meteor guide it is written:

We recommend naming your Blaze templates with the full path to the namespace, separated by underscores. Underscores are a great choice in this case because then you can easily type the name of the template as one symbol in JavaScript.

So what should I do?

Thanks.

Install the eslint-plugin-meteor by running: npm install eslint-plugin-meteor --save-dev

Then add this rule to your rules:
“meteor/template-names”: [2, “snake-case”]

This should fix your problem

1 Like

Just to add - if you want to see a working example of this, checkout the todos app package.json eslintConfig section:

  ...
  "eslintConfig": {
    "parserOptions": {
      "ecmaVersion": 6,
      "sourceType": "module"
    },
    "plugins": [
      "meteor"
    ],
    "extends": [
      "airbnb/base",
      "plugin:meteor/recommended"
    ],
    "rules": {
      "meteor/eventmap-params": [
        2,
        {
          "eventParamName": "event",
          "templateInstanceParamName": "instance"
        }
      ],
      "meteor/template-names": [
        0
      ]
    }
  },
  ...
1 Like

Thank you, snake-case was what I was missing. This works perfectly!