Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use prettier for formatting instead of eslint #447

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
/**
* @type {import('eslint').Linter.LegacyConfig}
*/
module.exports = {
extends: ['airbnb-base', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['unicorn', 'import', 'prettier', '@typescript-eslint'],
plugins: ['unicorn', 'import', '@typescript-eslint'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 'latest',
sourceType: 'module',
},
reportUnusedDisableDirectives: true,
ignorePatterns: [
'.eslintrc.js',
'packages/*/lib/',
'packages/*/bin/',
'packages/neovim/scripts/',
'packages/integration-tests/__tests__/',
'examples/rplugin/node/',
'packages/example-plugin/',
'packages/example-plugin-decorators/',
],
env: {
node: true,
es2024: true,
Expand Down Expand Up @@ -66,9 +80,6 @@ module.exports = {
'no-shadow': 'off',
'prefer-destructuring': 'off', // Intentionally disabled trash.

// prettier things
'prettier/prettier': 'error',

'import/extensions': 'off',
'import/prefer-default-export': 'off',

Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# some tests seem to create these files in CI
nvim-win64
130 changes: 0 additions & 130 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-unicorn": "^50.0.1",
"husky": "^9.1.4",
"lint-staged": "^15.2.10",
Expand All @@ -34,7 +33,8 @@
"test-staged": "npm run test-staged --workspaces --if-present -- --",
"test-missing-apis": "npm run test-missing-apis --workspaces --if-present",
"test-lint": "npm run lint",
"lint": "eslint --format=unix packages/*/src/**/*.ts packages/*/src/*.ts"
"lint": "prettier --check . && eslint --format=unix .",
"fixlint": "prettier --write . && eslint --fix --format=unix ."
},
"husky": {
"hooks": {
Expand All @@ -43,7 +43,7 @@
},
"lint-staged": {
"*.{ts,js}": [
"eslint --fix",
"npm run fixlint",
"npm run test-staged"
]
},
Expand Down
4 changes: 1 addition & 3 deletions packages/decorators/src/plugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,13 @@ function wrapper(cls: PluginWrapperConstructor, options?: PluginOptions): any {
}

// Can decorate a class with options object
// eslint-disable-next-line import/export

export function Plugin(
outter: any
): (cls: PluginWrapperConstructor, options?: PluginOptions) => any;

// eslint-disable-next-line import/export
export function Plugin(outter: any): any;

// eslint-disable-next-line import/export
export function Plugin(outter: any): any {
/**
* Decorator should support
Expand Down
22 changes: 11 additions & 11 deletions packages/neovim/src/api/Neovim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ import { ApiInfo } from '../types/ApiInfo';
export interface UiAttachOptions {
rgb?: boolean;
override?: boolean;
// eslint-disable-next-line camelcase

ext_cmdline?: boolean;
// eslint-disable-next-line camelcase

ext_hlstate?: boolean;
// eslint-disable-next-line camelcase

ext_linegrid?: boolean;
// eslint-disable-next-line camelcase

ext_messages?: boolean;
// eslint-disable-next-line camelcase

ext_multigrid?: boolean;
// eslint-disable-next-line camelcase

ext_popupmenu?: boolean;
// eslint-disable-next-line camelcase

ext_tabline?: boolean;
// eslint-disable-next-line camelcase

ext_wildmenu?: boolean;
// eslint-disable-next-line camelcase

ext_termcolors?: boolean;
}

Expand Down Expand Up @@ -56,7 +56,7 @@ export interface Command {
nargs: string;
range: string;
name: string;
// eslint-disable-next-line camelcase

script_id: number;
bar: boolean;
register: boolean;
Expand All @@ -65,7 +65,7 @@ export interface Command {
complete?: null;
addr?: any;
count?: any;
// eslint-disable-next-line camelcase

complete_arg?: any;
}

Expand Down
1 change: 0 additions & 1 deletion packages/neovim/src/api/utils/createChainableApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export function createChainableApi(
},

set: (target: any, prop: string, value: any, receiver: Promise<any>) => {
// eslint-disable-next-line no-param-reassign
if (receiver && (receiver instanceof Promise || 'then' in receiver)) {
receiver.then(obj => {
if (prop in obj) {
Expand Down
4 changes: 2 additions & 2 deletions packages/neovim/src/host/NvimPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface NvimPluginOptions {

export interface AutocmdOptions {
pattern?: string;
// eslint-disable-next-line no-eval

eval?: string;
sync?: boolean;
}
Expand All @@ -24,7 +24,7 @@ export interface CommandOptions {
export interface NvimFunctionOptions {
sync?: boolean;
range?: string;
// eslint-disable-next-line no-eval

eval?: string;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/neovim/src/plugin/autocmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NVIM_SYNC, NVIM_SPEC, NVIM_METHOD_NAME } from './properties';

export interface AutocmdOptions {
pattern: string;
// eslint-disable-next-line no-eval

eval?: string;
sync?: boolean;
}
Expand Down
Loading