spinlud / sequelize-typescript-generator

71 stars 27 forks source link

Unexpected top-level property "exclude" #52

Open coder-free opened 1 year ago

coder-free commented 1 year ago

Hi, I use sequelize-typescript-generator library programmatically: sequelize-generator.ts:

import { IConfig, ModelBuilder, DialectMySQL } from 'sequelize-typescript-generator';

(async () => {
    const config: IConfig = {
        connection: {
            dialect: 'mysql',
            database: 'myDatabase',
            username: 'myUsername',
            password: 'myPassword'
        },
        metadata: {
            indices: true,
            case: 'CAMEL',
        },
        output: {
            clean: true,
            outDir: 'models'
        },
        strict: true,
    };

    const dialect = new DialectMySQL();

    const builder = new ModelBuilder(config, dialect);

    try {
        await builder.build();
    }
    catch(err) {
        console.error(err);
        process.exit(1);
    }    
})();

I run the typescript file with npm scripts: package.json:

{
  ......
  "scripts": {
    ......
    "sequelize-generator": "ts-node sequelize-generator/sequelize-generator.ts",
    ......
  },
  ......
}

Then I got this error (But the model file generate success) :

Error: ESLint configuration in .eslintrc.js is invalid:
        - Unexpected top-level property "exclude".

My .eslintrc.js is:

module.exports = {
    ......
    exclude: ["node_modules", "dist"]
};
spinlud commented 1 year ago

Hi, please try latest version 10.0.0 and let me know 🙂

coder-free commented 1 year ago

Hi, @spinlud . I got same error:

......
Generated index file at src/models-generator/index.ts
Linting files
Error: ESLint configuration in .eslintrc.js is invalid:
        - Unexpected top-level property "exclude".

    at ConfigValidator.validateConfigSchema (/Users/zbf/Desktop/xl/snow-account/snow-account-server/node_modules/@eslint/eslintrc/lib/shared/config-validator.js:272:19)
    at ConfigArrayFactory._normalizeConfigData (/Users/zbf/Desktop/xl/snow-account/snow-account-server/node_modules/@eslint/eslintrc/lib/config-array-factory.js:673:19)
    at ConfigArrayFactory.loadInDirectory (/Users/zbf/Desktop/xl/snow-account/snow-account-server/node_modules/@eslint/eslintrc/lib/config-array-factory.js:541:33)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/Users/zbf/Desktop/xl/snow-account/snow-account-server/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:392:46)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/Users/zbf/Desktop/xl/snow-account/snow-account-server/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:411:20)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/Users/zbf/Desktop/xl/snow-account/snow-account-server/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:411:20)
    at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/zbf/Desktop/xl/snow-account/snow-account-server/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:313:18)
    at FileEnumerator._iterateFilesRecursive (/Users/zbf/Desktop/xl/snow-account/snow-account-server/node_modules/eslint/lib/cli-engine/file-enumerator.js:450:49)
    at _iterateFilesRecursive.next (<anonymous>)
    at FileEnumerator.iterateFiles (/Users/zbf/Desktop/xl/snow-account/snow-account-server/node_modules/eslint/lib/cli-engine/file-enumerator.js:299:49)