Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Update eslint configuration when generating a new app #1370

Open
2 tasks
brandonroberts opened this issue Sep 26, 2024 · 3 comments
Open
2 tasks

Feature: Update eslint configuration when generating a new app #1370

brandonroberts opened this issue Sep 26, 2024 · 3 comments
Labels
accepting PRs enhancement New feature or request

Comments

@brandonroberts
Copy link
Member

Which scope/s are relevant/related to the feature request?

platform

Information

When using nx g @analogjs/platform:app to generate a new app, a .eslintrc.json is generated. This should be updated to generate a eslint.config.js that extends the root config.

Describe any alternatives/workarounds you're currently using

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@brandonroberts brandonroberts added enhancement New feature or request accepting PRs labels Sep 26, 2024
@mlc-mlapis
Copy link

mlc-mlapis commented Oct 8, 2024

Please, do it. I've hit that moment right now.

@mlc-mlapis
Copy link

Is something like this JS version:

// eslint.config.js
const nx = require('@nx/eslint-plugin');
const baseConfig = require('../../eslint.config.js');

module.exports = [
  ...baseConfig,
  ...nx.configs['flat/angular'],
  ...nx.configs['flat/angular-template'],
  {
    files: ['**/*.ts'],
    rules: {
      '@angular-eslint/directive-selector': [
        'error',
        {
          type: 'attribute',
          prefix: 'AnalogApp',
          style: 'camelCase'
        }
      ],
      '@angular-eslint/component-selector': [
          'error',
          {
            type: 'element',
            prefix: 'analog-app',
            style: 'kebab-case'
          }
        ]
    }
  },
  {
    files: ['**/*.html'],
    // Override or add rules here
    rules: {}
  }
];

correct transformation to the following default created JSON version?

// .eslintrc.json
{
  "extends": ["../../.eslintrc.json"],
  "ignorePatterns": ["!**/*"],
  "overrides": [
    {
      "files": ["*.ts"],
      "extends": [
        "plugin:@nx/angular",
        "plugin:@angular-eslint/template/process-inline-templates"
      ],
      "rules": {
        "@angular-eslint/directive-selector": [
          "error",
          {
            "type": "attribute",
            "prefix": "AnalogApp",
            "style": "camelCase"
          }
        ],
        "@angular-eslint/component-selector": [
          "error",
          {
            "type": "element",
            "prefix": "analog-app",
            "style": "kebab-case"
          }
        ]
      }
    },
    {
      "files": ["*.html"],
      "extends": ["plugin:@nx/angular-template"],
      "rules": {}
    }
  ]
}

@s0h311
Copy link
Contributor

s0h311 commented Oct 16, 2024

@brandonroberts I'd like to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting PRs enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants