amarcruz / eslint-plugin-prettierx Goto Github PK
View Code? Open in Web Editor NEWFormat your code with ESLint using Prettierx, with presets for Prettier and StandardJS
License: MIT License
Format your code with ESLint using Prettierx, with presets for Prettier and StandardJS
License: MIT License
I'm struggling with this warning, because I'm not able to see which rule is responsible for it - I see only prettierx/option.
I want to disable this rule and go with vue definition
How can I debug it to know which rule should I switch off ? Am I able to override only one rule ? when I have tried override one rule by "prettierx/options": [severity, options]
then It overrides whole config - am I right ?
In https://github.com/aMarCruz/eslint-plugin-prettierx#presets:
- standardx
Este es el estilo StandardJS, pero personalizable, como lo hace standardx.
(https://github.com/aMarCruz/eslint-plugin-prettierx/blame/master/README.md#L161)
Hello! Love prettierx, been using it for a couple years. I don't know when exactly, but recently, my linting started failing with an error on an invalid prettierx/options config (Error below). If I comment out the standardx extends, it seems to run successfully, but unsure what that really means in terms of not having a base config to extend.
Error:
❯ npm run lint
> [email protected] lint /Users/bduffey2/projects/nfl-pool-serverless/nfl-pool-be
> eslint src/ --ext .js,.ts
Oops! Something went wrong! :(
ESLint: 7.19.0
Error: .eslintrc.js » plugin:prettierx/standardx:
Configuration for rule "prettierx/options" is invalid:
Value {"alignObjectProperties":false,"alignTernaryLines":false,"arrowParens":"avoid","bracketSpacing":true,"breakBeforeElse":false,"endOfLine":"lf","generatorStarSpacing":true,"htmlWhitespaceSensitivity":"css","indentChains":true,"insertPragma":false,"jsxBracketSameLine":false,"jsxSingleQuote":true,"parenSpacing":false,"printWidth":80,"proseWrap":"preserve","quoteProps":"as-needed","requirePragma":false,"semi":false,"singleQuote":true,"spaceBeforeFunctionParen":true,"tabWidth":2,"trailingComma":"none","useTabs":false,"yieldStarSpacing":true} should NOT have additional properties.
at ConfigValidator.validateRuleOptions (/Users/bduffey2/projects/nfl-pool-serverless/nfl-pool-be/node_modules/@eslint/eslintrc/lib/shared/config-validator.js:142:23)
at /Users/bduffey2/projects/nfl-pool-serverless/nfl-pool-be/node_modules/@eslint/eslintrc/lib/shared/config-validator.js:197:18
at Array.forEach (<anonymous>)
at ConfigValidator.validateRules (/Users/bduffey2/projects/nfl-pool-serverless/nfl-pool-be/node_modules/@eslint/eslintrc/lib/shared/config-validator.js:194:34)
at ConfigValidator.validateConfigArray (/Users/bduffey2/projects/nfl-pool-serverless/nfl-pool-be/node_modules/@eslint/eslintrc/lib/shared/config-validator.js:320:18)
at CascadingConfigArrayFactory._finalizeConfigArray (/Users/bduffey2/projects/nfl-pool-serverless/nfl-pool-be/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:493:23)
at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/bduffey2/projects/nfl-pool-serverless/nfl-pool-be/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:299:21)
at FileEnumerator._iterateFilesRecursive (/Users/bduffey2/projects/nfl-pool-serverless/nfl-pool-be/node_modules/eslint/lib/cli-engine/file-enumerator.js:476:49)
at _iterateFilesRecursive.next (<anonymous>)
at FileEnumerator.iterateFiles (/Users/bduffey2/projects/nfl-pool-serverless/nfl-pool-be/node_modules/eslint/lib/cli-engine/file-enumerator.js:296:49)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] lint: `eslint src/ --ext .js,.ts`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/bduffey2/.npm/_logs/2021-02-02T01_28_51_650Z-debug.log
My .eslintrc.js file:
module.exports = {
root: true,
env: {
es2021: true,
jest: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
warnOnUnsupportedTypeScriptVersion: false,
ecmaVersion: 7,
project: './tsconfig.json',
sourceType: 'module',
},
plugins: ['graphql', 'import', 'prettierx', '@typescript-eslint'],
settings: {
prettierx: {
usePrettierrc: false,
},
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/typescript',
'plugin:import/warnings',
'plugin:prettierx/standardx',
'plugin:prettierx/@typescript-eslint',
'plugin:you-dont-need-momentjs/recommended',
],
rules: {
'prettierx/options': [
2,
{
alignObjectProperties: false,
semi: true,
singleQuote: true,
spaceBeforeFunctionParen: true,
trailingComma: 'all',
useTabs: true,
},
],
'linebreak-style': 'off',
'no-console': 'off',
'no-constant-condition': 'off',
'no-unused-vars': [
'warn',
{
varsIgnorePattern: 'UU',
args: 'none',
},
],
quotes: 'off',
'import/named': 2,
'import/order': [
'error',
{
alphabetize: {
caseInsensitive: true,
order: 'asc',
},
'newlines-between': 'always',
},
],
'one-var': ['error', 'never'],
'no-var': 'error',
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: '*',
next: 'return',
},
{
blankLine: 'always',
prev: ['const', 'let', 'var'],
next: '*',
},
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
{
blankLine: 'always',
prev: ['block', 'block-like', 'if'],
next: '*',
},
{
blankLine: 'always',
prev: '*',
next: ['block', 'block-like', 'if'],
},
{
blankLine: 'any',
prev: 'export',
next: '*',
},
{
blankLine: 'any',
prev: '*',
next: 'export',
},
],
'@typescript-eslint/indent': 'off',
'@typescript-eslint/prefer-interface': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/explicit-function-return-type': 'error',
'prefer-template': 'error',
},
};
Any help would be appreciated with this!
Every time I start ESLint I see the same warning:
$ npx eslint .
Clearing config cache ...
What does it mean? Does it mean that there is a problem with my config?
Should we remove it or make the text more clear?
prettierx
version 0.19 has been available since July 7th... could we get an update on this one as well?
I have modified default printWidth
to 100. It is not being respected by eslint-plugin-prettierx
.
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 9,
sourceType: 'module'
},
env: {
node: true,
es6: true
},
plugins: [
'node',
'prettierx'
],
extends: [
'plugin:node/recommended',
'plugin:prettierx/standardx'
],
settings: {
prettierx: {
usePrettierrc: true,
editorconfig: true,
useCache: false
}
},
rules: {
'node/no-extraneous-require': 0
}
}
{
"printWidth": 100,
"semi": false,
"singleQuote": true,
"jsxBracketSameLine": true,
"endOfLine": "lf",
"spaceBeforeFunctionParen": true
}
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{json,js,yml}]
indent_style = space
indent_size = 2
max_line_length = 100
[*.{md}]
indent_style = space
indent_size = 4
Running command eslint . --ext .js --config .eslintrc.js
, I get complaints about line size that are above the default prettier length, but below 100.
I have a project which is using ESLint v8.x (the latest major version; released earlier this year). I am unable (without --force) to install eslint-plugin-prettierx
because the ESLint peer dependency of this package is declared to be ^7.0.0
.
If you are okay with an open-ended range, then I'd recommend using >=7.0
instead of a caret-range which won't include other major versions. Of course there is the problem when a major version comes along that isn't compatible.
Note: As a temporary work-around, you can use the --force
option with the npm command:
npm install --save-dev --force eslint-plugin-prettierx
I'm not sure if this is even possible but, what I'm trying to do is use your plugin in place of prettier for MDX files. I use it successfully with React files but I haven't been able to do the same with MDX. Is this possible?
Also thank you for making this plugin. I use it for all my personal projects.
Presets removal is not clearly documented.
~/SAPDevelop/poolifier-git (master ✘)✹ ᐅ npm run lint:fix
> [email protected] lint:fix /Users/I339261/SAPDevelop/poolifier-git
> eslint . --fix
Oops! Something went wrong! :(
ESLint: 7.25.0
ESLint couldn't find the config "plugin:prettierx/@typescript-eslint" to extend from. Please check that the name of the config is correct.
The config "plugin:prettierx/@typescript-eslint" was referenced from the config file in "/Users/I339261/SAPDevelop/poolifier-git/.eslintrc.js".
If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.
Hi!
I'm pretty frustrated with prettier/prettier#840, so I'm looking to use the breakBeforeElse
option in prettierx instead of prettier, however, it doesn't appear that eslint-plugin-prettierx
supports this option currently.
Here's how I have it set up in my eslintrc.json
rules section:
"prettierx/options": [
1,
{
"breakBeforeElse": true
}
],
When I try to run eslint in Atom, I get an error:
.eslintrc.json: Configuration for rule "prettierx/options" is invalid: Value {"breakBeforeElse":true} should NOT have additional properties.
Am I missing something? or does this need to be added to the eslint-plugin-prettierx
schema in order to work?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.