Skip to content

[member-ordering] support private fields #4182

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

Closed
2 of 4 tasks
ersimont opened this issue Nov 18, 2021 · 3 comments · Fixed by #5859
Closed
2 of 4 tasks

[member-ordering] support private fields #4182

ersimont opened this issue Nov 18, 2021 · 3 comments · Fixed by #5859
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@ersimont
Copy link

ersimont commented Nov 18, 2021

Repro

{
  "rules": {
    "@typescript-eslint/member-ordering": ["error"]
  }
}
class OrderMe {
  #imPrivate() {}
  imPublic() {}
}

Expected Result

To receive this linting error

Member imPublic should be declared before all private instance method definitions   @typescript-eslint/member-ordering

Actual Result

No linting error

Additional Info

  eslint:cli CLI args: [ 'C:\\Users\\xemno\\IdeaProjects\\s-libs\\projects\\ng-dev\\src\\lib\\order-me.ts', '--debug' ] +0ms
  eslint:cli Running on files +3ms
  eslintrc:config-array-factory Loading .eslintignore file: C:\Users\xemno\IdeaProjects\s-libs\.eslintignore +0ms
  eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs', loose: false } ] +0ms
  eslintrc:ignore-pattern   processed: { basePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs', patterns: [ '/**/node_modules/*' ] } +2ms
  eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs', loose: false } ] +1ms
  eslintrc:ignore-pattern   processed: { basePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs', patterns: [ '/**/node_modules/*' ] } +0ms
  eslint:file-enumerator Start to iterate files: [ 'C:\\Users\\xemno\\IdeaProjects\\s-libs\\projects\\ng-dev\\src\\lib\\order-me.ts' ] +0ms
  eslint:file-enumerator File: C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src\lib\order-me.ts +0ms
  eslintrc:cascading-config-array-factory Load config files for C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src\lib. +0ms
  eslintrc:cascading-config-array-factory No cache found: C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src\lib. +1ms
  eslintrc:config-array-factory Config file not found on C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src\lib +6ms
  eslintrc:cascading-config-array-factory No cache found: C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src. +1ms
  eslintrc:config-array-factory Config file not found on C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src +1ms
  eslintrc:cascading-config-array-factory No cache found: C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev. +0ms
  eslintrc:config-array-factory Loading package.json config file: C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\package.json +1ms
  eslintrc:config-array-factory Loading JSON config file: C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\package.json +0ms
  eslintrc:config-array-factory Error reading package.json file: C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\package.json +1ms
  eslintrc:config-array-factory Config file not found on C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev +0ms
  eslintrc:cascading-config-array-factory No cache found: C:\Users\xemno\IdeaProjects\s-libs\projects. +2ms
  eslintrc:config-array-factory Config file not found on C:\Users\xemno\IdeaProjects\s-libs\projects +1ms
  eslintrc:cascading-config-array-factory No cache found: C:\Users\xemno\IdeaProjects\s-libs. +1ms
  eslintrc:config-array-factory Loading JSON config file: C:\Users\xemno\IdeaProjects\s-libs\.eslintrc.json +1ms
  eslintrc:config-array-factory Config file found: C:\Users\xemno\IdeaProjects\s-libs\.eslintrc.json +0ms
  eslintrc:config-array-factory Loading parser "@typescript-eslint/parser" from C:\Users\xemno\IdeaProjects\s-libs\.eslintrc.json +2ms
  eslintrc:config-array-factory Loaded: @typescript-eslint/parser@5.4.0 (C:\Users\xemno\IdeaProjects\s-libs\node_modules\@typescript-eslint\parser\dist\index.js) +1ms
  eslintrc:config-array-factory Loading plugin "@typescript-eslint" from C:\Users\xemno\IdeaProjects\s-libs\.eslintrc.json +297ms
  eslintrc:config-array-factory Loaded: @typescript-eslint/eslint-plugin@5.4.0 (C:\Users\xemno\IdeaProjects\s-libs\node_modules\@typescript-eslint\eslint-plugin\dist\index.js) +2ms
  eslint:rules Loading rule 'brace-style' (remaining=284) +0ms
  eslint:rules Loading rule 'comma-dangle' (remaining=283) +6ms
  eslint:rules Loading rule 'dot-notation' (remaining=282) +7ms
  eslint:rules Loading rule 'indent' (remaining=281) +5ms
  eslint:rules Loading rule 'init-declarations' (remaining=280) +3ms
  eslint:rules Loading rule 'keyword-spacing' (remaining=279) +1ms
  eslint:rules Loading rule 'lines-between-class-members' (remaining=278) +1ms
  eslint:rules Loading rule 'no-dupe-class-members' (remaining=277) +19ms
  eslint:rules Loading rule 'no-duplicate-imports' (remaining=276) +1ms
  eslint:rules Loading rule 'no-empty-function' (remaining=275) +2ms
  eslint:rules Loading rule 'no-extra-parens' (remaining=274) +3ms
  eslint:rules Loading rule 'no-extra-semi' (remaining=273) +1ms
  eslint:rules Loading rule 'no-invalid-this' (remaining=272) +8ms
  eslint:rules Loading rule 'no-loop-func' (remaining=271) +2ms
  eslint:rules Loading rule 'no-loss-of-precision' (remaining=270) +1ms
  eslint:rules Loading rule 'no-magic-numbers' (remaining=269) +2ms
  eslint:rules Loading rule 'no-restricted-imports' (remaining=268) +12ms
  eslint:rules Loading rule 'no-unused-expressions' (remaining=267) +24ms
  eslint:rules Loading rule 'no-useless-constructor' (remaining=266) +2ms
  eslint:rules Loading rule 'object-curly-spacing' (remaining=265) +7ms
  eslint:rules Loading rule 'quotes' (remaining=264) +19ms
  eslint:rules Loading rule 'semi' (remaining=263) +9ms
  eslint:rules Loading rule 'space-infix-ops' (remaining=262) +2ms
  eslintrc:config-array-factory Plugin C:\Users\xemno\IdeaProjects\s-libs\node_modules\@typescript-eslint\eslint-plugin\dist\index.js loaded in: 218ms +218ms
  eslintrc:cascading-config-array-factory Stop traversing because of 'root:true'. +521ms
  eslintrc:cascading-config-array-factory Configuration was determined: ConfigArray(4) [ { type: 'config', name: 'DefaultIgnorePattern', filePath: '', criteria: null, env: undefined, globals: undefined, ignorePatter
n: IgnorePattern { patterns: [Array], basePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs', loose: false }, noInlineConfig: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: undefi
ned, reportUnusedDisableDirectives: undefined, root: undefined, rules: undefined, settings: undefined }, { type: 'config', name: '.eslintrc.json', filePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs\\.eslintrc.json',
criteria: null, env: undefined, globals: undefined, ignorePattern: undefined, noInlineConfig: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: undefined, reportUnusedDisableDire
ctives: undefined, root: true, rules: undefined, settings: undefined }, { type: 'config', name: '.eslintrc.json#overrides[0]', filePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs\\.eslintrc.json', criteria: { includes
: [Array], excludes: null, basePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs' }, env: undefined, globals: undefined, ignorePattern: undefined, noInlineConfig: undefined, parser: { error: null, filePath: 'C:\\Users\\
xemno\\IdeaProjects\\s-libs\\node_modules\\@typescript-eslint\\parser\\dist\\index.js', id: '@typescript-eslint/parser', importerName: '.eslintrc.json#overrides[0]', importerPath: 'C:\\Users\\xemno\\IdeaProjects\\s-
libs\\.eslintrc.json' }, parserOptions: { project: [Array], createDefaultProgram: true }, plugins: { '@typescript-eslint': [Object] }, processor: undefined, reportUnusedDisableDirectives: undefined, root: undefined,
 rules: { '@typescript-eslint/member-ordering': [Array] }, settings: undefined }, { type: 'ignore', name: '.eslintignore', filePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs\\.eslintignore', criteria: null, env: unde
fined, globals: undefined, ignorePattern: IgnorePattern { patterns: [Array], basePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs', loose: true }, noInlineConfig: undefined, parser: undefined, parserOptions: undefined,
 plugins: undefined, processor: undefined, reportUnusedDisableDirectives: undefined, root: undefined, rules: undefined, settings: undefined } ] on C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src\lib +11ms
  eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs', loose: false }, IgnorePattern { patterns: [ '**/*.dts-spec.ts' ], base
Path: 'C:\\Users\\xemno\\IdeaProjects\\s-libs', loose: true } ] +541ms
  eslintrc:ignore-pattern   processed: { basePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs', patterns: [ '/**/node_modules/*', '**/*.dts-spec.ts' ] } +1ms
  eslintrc:ignore-pattern Check {
  filePath: 'C:\\Users\\xemno\\IdeaProjects\\s-libs\\projects\\ng-dev\\src\\lib\\order-me.ts',
  dot: false,
  relativePath: 'projects/ng-dev/src/lib/order-me.ts',
  result: false
} +1ms
  eslint:cli-engine Lint C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src\lib\order-me.ts +0ms
  eslint:linter Linting code for C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src\lib\order-me.ts (pass 1) +0ms
  eslint:linter Verify +0ms
  eslint:linter With ConfigArray: C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src\lib\order-me.ts +0ms
  eslint:linter Generating fixed text for C:\Users\xemno\IdeaProjects\s-libs\projects\ng-dev\src\lib\order-me.ts (pass 1) +4s
  eslint:source-code-fixer Applying fixes +0ms
  eslint:source-code-fixer shouldFix parameter was false, not attempting fixes +1ms
  eslint:file-enumerator Complete iterating files: ["C:\\Users\\xemno\\IdeaProjects\\s-libs\\projects\\ng-dev\\src\\lib\\order-me.ts"] +5s
  eslint:cli-engine Linting complete in: 4875ms +4s

Versions

package version
@typescript-eslint/eslint-plugin 5.4.0
@typescript-eslint/parser 5.4.0
TypeScript 4.4.4
ESLint 8.2.0
node 14.18.1
@ersimont ersimont added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Nov 18, 2021
@bradzacher bradzacher changed the title [member-order] Javascript private methods treated as public [member-order] support private fields Nov 23, 2021
@bradzacher bradzacher added enhancement New feature or request and removed triage Waiting for team members to take a look labels Nov 23, 2021
@bradzacher
Copy link
Member

The rule does not currently support private fields.

@bradzacher bradzacher added the accepting prs Go ahead, send a pull request that resolves this issue label Nov 23, 2021
@Lonli-Lokli

This comment was marked as off-topic.

@bradzacher

This comment was marked as off-topic.

@armano2 armano2 changed the title [member-order] support private fields [member-ordering] support private fields Jun 8, 2022
sviat9440 pushed a commit to MillerSvt/typescript-eslint that referenced this issue Oct 23, 2022
sviat9440 added a commit to MillerSvt/typescript-eslint that referenced this issue Oct 23, 2022
sviat9440 added a commit to MillerSvt/typescript-eslint that referenced this issue Oct 24, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants