evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
4.11k stars 193 forks source link

Eslint prettier rules not firing in .md files #1069

Closed jdimmerman closed 3 weeks ago

jdimmerman commented 1 year ago

Steps To Reproduce

With my eslint configuration, which includes prettier, the eslint rules themselves are firing on the javascript but the prettier rules are not.

Some notes

I've posted my eslint config below and then these screenshots to illustrate the issue. Notice

image image

Environment

.eslintrc.cjs

module.exports = {
  env: {
    browser: true,
    es2021: true,
  },
  extends: ['standard', 'prettier', 'plugin:svelte/recommended'],
  parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
  },
  plugins: ['prettier', 'mdx'],
  rules: {
    'prettier/prettier': ['error'],
  },
  overrides: [
    {
      files: '*.svelte',
      rules: {
        'no-unused-expressions': 'off',
        'no-sequences': 'off',
        'no-use-before-define': 'off',
        camelcase: 'off',
      },
    },
    {
      files: '*.md',
      parser: 'svelte-eslint-parser',
      // processor: 'svelte/.svelte', // this did not help
      extends: ['plugin:mdx/recommended'], // commenting this out causes a syntax error around frontmatter but did not cause the prettier rules to fire
      rules: {
        'no-unused-expressions': 'off',
        'no-sequences': 'off',
        'no-use-before-define': 'off',
        camelcase: 'off',
      },
    },
  ],
  globals: {
    Column: true,
    Tab: true,
    Tabs: true,
  },
};

.prettierrc

{
    "semi": true,
    "singleQuote": true,
    "tabWidth": 2
}

Expected Behavior

Eslint and prettier rules fire in .md files, similar to .svelte files

Actual Behaviour

Only Eslint rules fire in the .md files and prettier rules do not.

Workarounds

Don't use prettier in .md files.

RandomFractals commented 1 year ago

@jdimmerman thank you for posting these details.

we'll try to reproduce your current linters config in a week or so, as we are taking some time off after this brisk tooling run to get some cool new basic commands for you to use on Evidence dev projects in vscode.

Your notes are stellar and we might have a solution for that markdown related linting problem later on.

Also, good to see that you are testing it with mdx too. It's one of the well designed and supported markdown extensions ecosystems out there.

jdimmerman commented 1 year ago

@RandomFractals that sounds great and I get that... I hope that you have a good and relaxing week and thanks!

jdimmerman commented 1 year ago

Hey @RandomFractals - Just following up here, thanks!

archiewood commented 1 year ago

@hughess

archiewood commented 1 year ago

And @ItsMeBrianD - I'm guessing this should be in the main evidence repo? WDYT?

ItsMeBrianD commented 1 year ago

Yeah I think the main repo is the best place to address this