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

Add option to choose line endings within strings in custom-elements.json #217

Open
1 of 2 tasks
xander-marjoram opened this issue Jul 26, 2023 · 0 comments
Open
1 of 2 tasks

Comments

@xander-marjoram
Copy link

Checklist

  • Did you run the analyzer with the --dev flag to get more information?
  • Did you create a minimal reproduction in the playground?

I did not create a minimal repro because it does not seem to support TypeScript Lit elements.

Expected behavior
A clear and concise description of what you expected to happen.

I have a Lit component written in TypeScript. It has a property defined like so:

@property({ type: Object })
public leadingAction: {
    text: string;
};

When I run yarn cem analyze --litelement on Windows, the custom-elements.json file that is created contains the following:

{
    "kind": "field",
    "name": "leadingAction",
    "type": {
        "text": "{\r\n        text: string;\r\n    }"
    },
    "privacy": "public",
    "attribute": "leadingAction"
},

When my colleagues run the same command on MacOS, their string value of type.text contains the newline character \n instead of the carriage return \r\n.

I would like to be able to configure the CEM analyzer to output \n instead of \r\n to avoid unnecessary code conflicts/updates between runs on different operating systems.

In case it is useful, here is my custom-elements-manifest.config.mjs:

import { moduleFileExtensionsPlugin } from 'cem-plugin-module-file-extensions';

export default {
    globs: [
        '../../components/**/src/**/!(*.css).ts',
    ],
    exclude: [
        '../../**/*.d.ts',
        '../../**/*.d.js',
        '../../**/react.ts',
        '../../**/test/**',
        'node_modules/*',
        '../../**/node_modules/**',
        '../../**/pie-webc-testing/**',
    ],
    plugins: [moduleFileExtensionsPlugin()],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant