qcarpentier / lovelace

Lovelace is (not yet) the best Discord bot to bootstrap your Discord server.
1 stars 0 forks source link

Settings up Typescript and Eslint #2

Closed SirMishaa closed 4 years ago

SirMishaa commented 4 years ago

I propose to use Typescript and Eslint and Yarn as dependency manager.

List of dependencies to be installed :

The following configurations should be right

.eslintrc.js :

module.exports = {
    parser: '@typescript-eslint/parser', // Specifies the ESLint parser
    plugins: ['@typescript-eslint'],
    extends: [
        'eslint:recommended',
        'plugin:@typescript-eslint/eslint-recommended',
        'plugin:@typescript-eslint/recommended',
        'plugin:@typescript-eslint/recommended-requiring-type-checking',
    ],
    parserOptions: {
        ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features
        sourceType: 'module', // Allows for the use of imports
        tsconfigRootDir: __dirname,
        project: './tsconfig.json',
    },
    env: {
        es6: true,
        node: true,
    },
    rules: {
        semi: "error"
    }
};

tsconfig.json :

{
  "compilerOptions": {
    "module": "commonjs",
    "moduleResolution": "node",
    "target": "es2016",
    "lib": [
      "es6",
      "dom"
    ],
    "outDir": "build",
    "rootDir": "src",
    "sourceMap": true,
    "noImplicitAny": true,
    "types": [
      "node",
      "reflect-metadata"
    ],
    "typeRoots": [
      "node_modules/@types"
    ],
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "resolveJsonModule": true
  },
  "exclude": [
    "node_modules",
    "build"
  ]
}
SirMishaa commented 4 years ago

Issue #3 should be implemented before Typescript and Eslint can be implemented correctly.

SirMishaa commented 4 years ago

There are still some small problems with the configuration of ESlint, such as the fact that spaces and tabs can be used at the same time. (All that's missing are some extra rules)

I'm trying to solve the problem as soon as possible.