Skip to content

Commit 0592199

Browse files
committed
Use eslint&prettier for code linting&formatting
1 parent 2a3873a commit 0592199

File tree

173 files changed

+8962
-3840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+8962
-3840
lines changed

Diff for: .eslintrc.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
module.exports = {
2+
ignorePatterns: [
3+
'node_modules/*',
4+
'/*',
5+
'!arduino-ide-extension',
6+
'arduino-ide-extension/*',
7+
'!arduino-ide-extension/src',
8+
'arduino-ide-extension/src/node/cli-protocol',
9+
],
10+
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
11+
parserOptions: {
12+
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
13+
sourceType: 'module', // Allows for the use of imports
14+
ecmaFeatures: {
15+
jsx: true, // Allows for the parsing of JSX
16+
},
17+
},
18+
settings: {
19+
react: {
20+
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
21+
},
22+
},
23+
extends: [
24+
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
25+
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
26+
'plugin:react-hooks/recommended', // Uses recommended rules from react hooks
27+
'plugin:prettier/recommended',
28+
'prettier', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
29+
],
30+
plugins: ['prettier'],
31+
root: true,
32+
rules: {
33+
'@typescript-eslint/no-unused-expressions': 'off',
34+
'@typescript-eslint/no-namespace': 'off',
35+
'@typescript-eslint/no-var-requires': 'off',
36+
'@typescript-eslint/no-empty-function': 'warn',
37+
'@typescript-eslint/no-empty-interface': 'warn',
38+
'react/display-name': 'warn',
39+
eqeqeq: ['error', 'smart'],
40+
'guard-for-in': 'off',
41+
'id-blacklist': 'off',
42+
'id-match': 'off',
43+
'no-underscore-dangle': 'off',
44+
'no-unused-expressions': 'off',
45+
'no-var': 'error',
46+
radix: 'error',
47+
'prettier/prettier': 'warn',
48+
},
49+
};

Diff for: .prettierrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"singleQuote": true,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"overrides": [
6+
{
7+
"files": "*.{json,yml}",
8+
"options": {
9+
"tabWidth": 2
10+
}
11+
}
12+
]
13+
}

Diff for: .vscode/settings.json

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
{
2-
"tslint.enable": true,
3-
"tslint.configFile": "./tslint.json",
4-
"editor.formatOnSave": true,
52
"files.exclude": {
63
"**/lib": false
74
},
8-
"editor.insertSpaces": true,
9-
"editor.detectIndentation": false,
10-
"[typescript]": {
11-
"editor.tabSize": 4
5+
"typescript.tsdk": "node_modules/typescript/lib",
6+
"editor.codeActionsOnSave": {
7+
"source.fixAll.eslint": true
128
},
13-
"[json]": {
14-
"editor.tabSize": 2
15-
},
16-
"[jsonc]": {
17-
"editor.tabSize": 2
18-
},
19-
"files.insertFinalNewline": true,
20-
"typescript.tsdk": "node_modules/typescript/lib"
219
}

Diff for: arduino-ide-extension/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"download-ls": "node ./scripts/download-ls.js",
1111
"download-examples": "node ./scripts/download-examples.js",
1212
"generate-protocol": "node ./scripts/generate-protocol.js",
13-
"lint": "tslint -c ./tslint.json --project ./tsconfig.json",
13+
"lint": "eslint",
1414
"build": "tsc && ncp ./src/node/cli-protocol/ ./lib/node/cli-protocol/ && yarn lint",
1515
"watch": "tsc -w",
1616
"test": "mocha \"./lib/test/**/*.test.js\"",

Diff for: arduino-ide-extension/src/browser/arduino-commands.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,18 @@ import { Command } from '@theia/core/lib/common/command';
44
* @deprecated all these commands should go under contributions and have their command, menu, keybinding, and toolbar contributions.
55
*/
66
export namespace ArduinoCommands {
7-
87
export const TOGGLE_COMPILE_FOR_DEBUG: Command = {
9-
id: 'arduino-toggle-compile-for-debug'
8+
id: 'arduino-toggle-compile-for-debug',
109
};
1110

1211
/**
1312
* Unlike `OPEN_SKETCH`, it opens all files from a sketch folder. (ino, cpp, etc...)
1413
*/
1514
export const OPEN_SKETCH_FILES: Command = {
16-
id: 'arduino-open-sketch-files'
15+
id: 'arduino-open-sketch-files',
1716
};
1817

1918
export const OPEN_BOARDS_DIALOG: Command = {
20-
id: 'arduino-open-boards-dialog'
19+
id: 'arduino-open-boards-dialog',
2120
};
22-
2321
}

0 commit comments

Comments
 (0)