Skip to content

Commit

Permalink
Dev/sda/adds prettier updates eslint (#2311)
Browse files Browse the repository at this point in the history
chore: Updates linter
- Eslint has been updated
- Prettier has been added
- Code has been updated using new rules
- Fixes rule suggestions
  • Loading branch information
bk201- authored Sep 16, 2024
1 parent 519ed5e commit 4ca6fd6
Show file tree
Hide file tree
Showing 217 changed files with 16,447 additions and 17,550 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ gulpfile.ts
.eslintrc.js
**/*.d.ts
test/
webpack.config.js
webpack.config.*.js
47 changes: 41 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
module.exports = {
"extends": "@microsoft/eslint-config-azuretools",
"rules": {
"import/no-internal-modules": [ "error", {
"allow": [ "antlr4ts/**" ]
} ]
}
env: {
es6: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'import'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
rules: {
'@typescript-eslint/no-restricted-types': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/prefer-regexp-exec': 'off',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/unbound-method': 'warn',
eqeqeq: ['error', 'always'],
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
'import/no-internal-modules': [
'error',
{
allow: ['antlr4ts/**', 'yaml/types'],
},
],
'no-case-declarations': 'error',
'no-constant-condition': 'error',
'no-inner-declarations': 'error',
'no-restricted-imports': ['error', { patterns: ['**/*/extension.bundle'] }],
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'no-useless-escape': 'error',
},
};
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": true,
"arrowParens": "always",
"plugins": ["prettier-plugin-organize-imports"]
}
10 changes: 6 additions & 4 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ declare let exports: { [key: string]: unknown };
async function prepareForWebpack(): Promise<void> {
const mainJsPath: string = path.join(__dirname, 'main.js');
let contents: string = (await fse.readFile(mainJsPath)).toString();
contents = contents
.replace('out/src/extension', 'dist/extension.bundle')
.replace(', true /* ignoreBundle */', '');
contents = contents.replace('out/src/extension', 'dist/extension.bundle').replace(', true /* ignoreBundle */', '');
await fse.writeFile(mainJsPath, contents);
}

async function cleanReadme(): Promise<void> {
const readmePath: string = path.join(__dirname, 'README.md');
let data: string = (await fse.readFile(readmePath)).toString();
data = data.replace(/<!-- region exclude-from-marketplace -->.*?<!-- endregion exclude-from-marketplace -->/gis, '');
data = data.replace(
// @ts-ignore
/<!-- region exclude-from-marketplace -->.*?<!-- endregion exclude-from-marketplace -->/gis,
'',
);
await fse.writeFile(readmePath, data);
}

Expand Down
Loading

0 comments on commit 4ca6fd6

Please sign in to comment.