`connections.transform` option conflicts with `no-template-curly-in-string`

This issue has been tracked since 2022-10-02.

Describe the bug

When linting .eslintrc.js or .eslintrc.cjs, the built in no-template-curly-in-string rule reports a problem with the connections.transform syntax with a dollar sign in a non-template string:

module.exports = {
  plugins: ['@ts-safeql/eslint-plugin'],
  rules: {
    '@ts-safeql/check-sql': [
      'error',
      {
        connections: [
          {
            databaseUrl: `postgres://postgres:[email protected]:5432/postgres`,
            tagName: 'sql',
            transform: '${type}[]', // 💥 Unexpected template string expression. (`no-template-curly-in-string`)
          },
        ],
      },
    ],
  },
};

To Reproduce

Steps to reproduce the behavior:

  1. Enable the no-template-curly-in-string to be a warning or error
  2. Lint a .eslintrc.js file with the connections.transform option as specified in the code block above
  3. Observe the problem reported by ESLint

Expected behavior

The recommended connections.transform configuration shouldn't cause an error with a built-in ESLint rule.

Maybe an alternative syntax that doesn't use the dollar?

Screenshots

--

Desktop (please complete the following information):

  • OS: macOS Monterey 12.6 (21G115)
  • PostgreSQL version 14.2
  • Version @ts-safeql/[email protected]

Additional context

--

Newbie012 wrote this answer on 2022-10-17

Do people lint their eslint config? I haven't thought about that... What would you recommend using instead?

karlhorky wrote this answer on 2022-10-17

Yeah I've seen it a few times.

What would you recommend using instead?

Maybe just the curly brackets without the dollar sign?

Or if that's too ambiguous, could switch the curlies to parentheses or angle brackets (either with or without dollar)

karlhorky wrote this answer on 2022-10-17

Thanks for the fix in @ts-safeql/[email protected] @Newbie012! 🙌 We tested and it's working!

More Details About Repo
Owner Name ts-safeql
Repo Name safeql
Full Name ts-safeql/safeql
Language TypeScript
Created Date 2022-09-08
Updated Date 2023-03-16
Star Count 795
Watcher Count 5
Fork Count 14
Issue Count 7

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date