Error: `severity` property of a stylelint warning must be either 'error' or 'warning', but it was 'ignore' (string) - visual-studio-code

VSCode-Stylelint showing meaningless error:
Error: severity property of a stylelint warning must be either 'error' or 'warning', but it was 'ignore' (string). at stylelintWarningToVscodeDiagnostic (/Users/xxx/.vscode/extensions/shinnn.stylelint-0.51.0/node_modules/stylelint-warning-to-vscode-diagnostic/index.js:40:9) at Array.map () at processResults (/Users/xxxs/shinnn.stylelint-0.51.0/node_modules/stylelint-vscode/index.js:59:18) at stylelintVSCode (/Users/xxx/.vscode/extensions/shinnn.stylelint-0.51.0/node_modules/stylelint-vscode/index.js:144:9)
My .stylelintrc.js
module.exports = {
defaultSeverity: 'warning',
extends: [
'stylelint-config-standard',
'stylelint-config-css-modules',
'stylelint-config-rational-order',
'stylelint-config-prettier',
],
plugins: ['stylelint-order', 'stylelint-declaration-block-no-ignored-properties'],
rules: {
'no-descending-specificity': null,
'plugin/declaration-block-no-ignored-properties': true,
'declaration-empty-line-before': null,
'length-zero-no-unit': null,
'function-whitespace-after': null,
},
};

There is something wrong with the newer Version of 'stylelint-config-rational-order'.
If you set it to Version 0.0.4 it works.
There is already an Issue created on Github:
https://github.com/constverum/stylelint-config-rational-order/issues/16

Related

Unexpected missing end-of-source newline

I am getting the above error with stylint. How to fix any one help me?
my scss file:
#tailwind base;
#tailwind components;
#tailwind utilities;
/* end of import */
Error I am getting:
src/components/tabs/tabs.scss
15:16 ⚠ Unexpected missing end-of-source newline (no-missing-end-of-source-newline) [stylelint]
[vite:css] Unexpected missing end-of-source newline (no-missing-end-of-source-newline)
13 | }
14 |
15 | /* empty line */
| ^
stylelint config:
/* eslint-env node */
module.exports = {
extends: [
'stylelint-config-standard',
'stylelint-config-recess-order',
'stylelint-config-css-modules',
'stylelint-config-prettier',
// Uncomment out the below if you want to use scss
'stylelint-config-standard-scss',
'stylelint-config-recommended-scss',
],
plugins: ['stylelint-scss'],
ignoreFiles: [
'./node_modules/**/*.css',
'./dist/**/*.css',
'./coverage/**/*.css',
],
rules: {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'tailwind',
'apply',
'screen',
'variants',
'responsive',
],
},
],
'no-duplicate-selectors': null,
'no-empty-source': null,
'rule-empty-line-before': null,
'comment-empty-line-before': null,
'selector-pseudo-element-no-unknown': null,
'declaration-block-trailing-semicolon': null,
'no-descending-specificity': null,
'string-no-newline': null,
// Limit the number of universal selectors in a selector,
// to avoid very slow selectors
'selector-max-universal': 1,
'selector-class-pattern': null,
// --------
// SCSS rules
// --------
'scss/dollar-variable-colon-space-before': 'never',
'scss/dollar-variable-colon-space-after': 'always',
'scss/dollar-variable-no-missing-interpolation': true,
'scss/dollar-variable-pattern': /^[a-z-]+$/,
'scss/double-slash-comment-whitespace-inside': 'always',
'scss/operator-no-newline-before': true,
'scss/operator-no-unspaced': true,
'scss/selector-no-redundant-nesting-selector': true,
// Allow SCSS and CSS module keywords beginning with `#`
'scss/at-rule-no-unknown': null,
},
};
The no-missing-end-of-source-newline rule expects a newline at the end of the file. Add a newline to fix the problem:
#tailwind base;
#tailwind components;
#tailwind utilities;
/* end of import */
(Note the additional newline at the end.)
You should also extend Prettier's Stylelint configs last and there's no need to explicitly use postcss-scss or stylelint-config-recommended-scss as they are included in stylelint-config-standard-scss.
Your config should be:
module.exports = {
extends: [
'stylelint-config-standard-scss',
'stylelint-config-css-modules',
'stylelint-config-recess-order',
'stylelint-config-prettier-scss'
],
ignoreFiles: [
'./node_modules/**/*.css',
'./dist/**/*.css',
'./coverage/**/*.css',
],
rules: {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'tailwind',
'apply',
'screen',
'variants',
'responsive',
],
},
],
'no-duplicate-selectors': null,
'no-empty-source': null,
'rule-empty-line-before': null,
'comment-empty-line-before': null,
'selector-pseudo-element-no-unknown': null,
'declaration-block-trailing-semicolon': null,
'no-descending-specificity': null,
'string-no-newline': null,
// Limit the number of universal selectors in a selector,
// to avoid very slow selectors
'selector-max-universal': 1,
'selector-class-pattern': null,
// --------
// SCSS rules
// --------
'scss/dollar-variable-colon-space-before': 'never',
'scss/dollar-variable-colon-space-after': 'always',
'scss/dollar-variable-no-missing-interpolation': true,
'scss/dollar-variable-pattern': /^[a-z-]+$/,
'scss/double-slash-comment-whitespace-inside': 'always',
'scss/operator-no-newline-before': true,
'scss/operator-no-unspaced': true,
'scss/selector-no-redundant-nesting-selector': true,
// Allow SCSS and CSS module keywords beginning with `#`
'scss/at-rule-no-unknown': null,
},
};

ionic serve complains about valid javascript "Parsing error: Unexpected token ="

I have a vuex-orm model called Profile.js
import { Model } from '#vuex-orm/core'
export default class Profile extends Model {
static entity = 'profile'
static fields () {
return {
id: this.uid(),
// etc...
}
}
}
When I run ionic serve I get the following output:
Build finished at 14:20:05 by 0.000s
[INFO] Browser window opened to http://localhost:4200!
ERROR in
[vue-cli-service] /home/user/IonicProjects/ionic/iloveu/src/store/models/Profile.js
[vue-cli-service] 4:19 error Parsing error: Unexpected token =
[vue-cli-service]
[vue-cli-service] ✖ 1 problem (1 error, 0 warnings)
[vue-cli-service]
[vue-cli-service] webpack compiled with 1 error
So it complains about this line
static entity = 'profile'
which is perfectly valid javascript or ecmascript.
What can I do so this valid code is not being tagged as erroneous?
my .eslintrc
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/vue3-essential',
'prettier'
],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/no-deprecated-slot-attribute': 'off'
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
env: {
jest: true
}
}
]
}
reference to the vuex-orm documentation
Seems like this is the culprint
parserOptions: {
ecmaVersion: 2020
},
changing it to
parserOptions: {
ecmaVersion: 2022
},
does not return this error anymore, which is weird because the Quasar framework uses ecmaVersion: 2018 and does not have this error.

TypeError [ERR_INVALID_ARG_TYPE]: The "superCtor" argument must be of type function. Received undefined

This issue showed up after trying to install Mongoose on my sapper project
util.js:157
throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "superCtor" argument must be of type function. Received undefined
at Object.inherits (util.js:157:11)
at Object.<anonymous> (<project path>\__sapper__\dev\server\server.js:140600:8)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'ERR_INVALID_ARG_TYPE'
}
> Server crashed
<project path> is just my project path
I have a theory that this is caused by the bundling/minifying of the server code into a single file (__sapper__/dev/server.js), not sure how to fix it though.
My server rollup config, if it helps:
{
server: {
input: { server: config.server.input().server.replace(/\.js$/, '.ts') },
output: { ...config.server.output(), sourcemap },
plugins: [
replace({
'process.browser': false,
'process.env.NODE_ENV': JSON.stringify(mode),
'module.require': 'require',
}),
svelte({
generate: 'ssr',
dev,
preprocess,
}),
resolve({
dedupe: ['svelte'],
}),
commonjs({
sourceMap: !!sourcemap,
}),
typescript({
noEmitOnError: !dev,
sourceMap: !!sourcemap,
}),
json(),
],
external: [...Object.keys(pkg.dependencies).concat(
require('module').builtinModules || Object.keys(process.binding('natives')),
), 'saslprep'],
preserveEntrySignatures: 'strict'
},
}
the config is based mostly off this template
Not sure that this will help you because I don't know what Mangose or Sapper are, but I got this error when #google-cloud/storage was getting imported.
The solution was to not bundle it in:
nodeResolve({
preferBuiltins: true,
browser: false,
resolveOnly: ['#google-cloud/storage']
}),

Input definition optional keys

I generated an action with sails generate action task/update-task. I now am trying to create an input parameter that should be an object with optional keys:
inputs: {
fields: {
type: {
body: 'string?',
rruleSetStr: 'string?',
},
required: true,
description: 'All keys are not required, but at least one is'
},
However I keep getting error:
The action `task/update-task` could not be registered. It looks like a machine definition (actions2), but it could not be used to build an action.
Details: ImplementationError: Sorry, could not interpret "task/update-task.js" because its underlying implementation has a problem:
------------------------------------------------------
• Invalid input definition ("fields"). Unrecognized `type`. (Must be 'string', 'number', 'boolean', 'json' or 'ref'. Or set it to a type schema like `[{id:'number', name: {givenName: 'Lisa'}}]`.)
------------------------------------------------------
If you are the maintainer of "task/update-task.js", then you can change its implementation to solve the problem above. Otherwise, please file a bug report with the maintainer, or fork your own copy and fix that.
[?] See https://sailsjs.com/support for help.
at machineAsAction (C:\Users\Mercurius\Documents\GitHub\Homie-Web\node_modules\machine-as-action\lib\machine-as-action.js:271:28)
at helpRegisterAction (C:\Users\Mercurius\Documents\GitHub\Homie-Web\node_modules\sails\lib\app\private\controller\help-register-action.js:63:27)
at C:\Users\Mercurius\Documents\GitHub\Homie-Web\node_modules\sails\lib\app\private\controller\load-action-modules.js:146:13
Does anyone know where the documentation is on how to make optional keys in this? I tried here - http://node-machine.org/spec/machine#inputs - but no luck.
Type must be 'string', 'number', 'boolean', 'json' or 'ref' like error say.
So u need set type to 'ref' (object or array), and u can use custom function for validate.
inputs: {
fields: {
type: 'ref',
custom: function (data) {
// some logic
// example
if (typeof data.body !== "string") {
return false;
// or u can use trow Error('Body is not a string')
}
return true;
},
required: true,
description: 'All keys are not required, but at least one is'
}
Now input is type object and in custom function return false or trow Error('Some problem') break validation.
If u use schema type, just remove ? from your example:
inputs: {
fields: {
type: {
body: 'string',
rruleSetStr: 'string'
},
required: true,
description: 'All keys are not required, but at least one is'
}
This is Runtime (recursive) type-checking for JavaScript., please check documentation for writing rules.

Getting "Invalid exit definition" on Compilation of Sails Helper (Sails v1.0)

I'm getting the error
Invalid exit definition ("success"). Must be a dictionary-- i.e. plain JavaScript object like `{}`.
Invalid exit definition ("error"). Must be a dictionary-- i.e. plain JavaScript object like `{}`.
when doing sails lift. The error is on getRole.js
module.exports = {
friendlyName: 'Get Role',
description: '',
inputs: {
user_id: {
friendlyName: 'User Id',
description: 'The ID of the user to check role',
type: 'string',
required: true
}
},
exits: {
success: function (role){
return role;
},
error: function (message) {
return message;
}
},
fn: function (inputs, exits) {
User.findOne({ id: inputs.user_id } , function (err, user) {
if (err) return exits.err(err);
return exits.success(user.role);
});
}
};
This is a new error, and looking at my git, nothing has changed in my code since it successfully compiled. I understand the Sails version (v1.0) I'm using in beta, so I'm taking that into account.
Exits cannot be defined as functions. There is a special syntax (Machine Spec) to define exits. In your example this should work:
exits: {
error: {
description: 'Unexpected error occurred.',
},
success: {
description: 'Role was succesffuly fetched'
}
},
You can read more info about helper exits here: https://next.sailsjs.com/documentation/concepts/helpers
May changes occur on the last release 1.0.0-38. I've not checked underneath yet, but the way to execute helpers changed: on .exec() I get errors. Now, use .switch();