Skip to content
Snippets Groups Projects
Select Git revision
  • bfd4ff80999d8a986bc3502fb5b3b7a5d9c50e04
  • master default protected
  • maj-readme
  • update-budget-msg-2022
  • share-with-metadata
  • explications-resultats-macros-PLF2022
  • plf_fix
  • benoit-cty-master-patch-87290
  • activate-plf-2021
  • stats
  • switch-plf
  • carto
  • adapt-matomo
  • js-to-ts
  • nbre-part-logic
  • add-nbre-part
  • 1.0.0
17 results

.eslintplugin.js

Blame
  • .eslintplugin.js 718 B
    module.exports = {
      rules: {
        "no-material-root-imports": {
          create(context) {
            return {
              ImportDeclaration(node) {
                const path = node.source.value;
                const forbiddenImports = ["@material-ui/core", "@material-ui/icons"];
                // eslint-disable-next-line no-restricted-syntax
                for (const imp of forbiddenImports) {
                  // The $ corresponds to the end of the sequence.
                  const regex = new RegExp(`${imp}$`);
                  if (regex.test(path)) {
                    context.report(node, `Importing elements from ${imp} is forbidden. Use ${imp}/xxx instead.`);
                  }
                }
              },
            };
          },
        },
      },
    };